xref: /dragonfly/sys/dev/raid/mlx/mlxio.h (revision 86d7f5d3)
1*86d7f5d3SJohn Marino /*-
2*86d7f5d3SJohn Marino  * Copyright (c) 1999 Michael Smith
3*86d7f5d3SJohn Marino  * All rights reserved.
4*86d7f5d3SJohn Marino  *
5*86d7f5d3SJohn Marino  * Redistribution and use in source and binary forms, with or without
6*86d7f5d3SJohn Marino  * modification, are permitted provided that the following conditions
7*86d7f5d3SJohn Marino  * are met:
8*86d7f5d3SJohn Marino  * 1. Redistributions of source code must retain the above copyright
9*86d7f5d3SJohn Marino  *    notice, this list of conditions and the following disclaimer.
10*86d7f5d3SJohn Marino  * 2. Redistributions in binary form must reproduce the above copyright
11*86d7f5d3SJohn Marino  *    notice, this list of conditions and the following disclaimer in the
12*86d7f5d3SJohn Marino  *    documentation and/or other materials provided with the distribution.
13*86d7f5d3SJohn Marino  *
14*86d7f5d3SJohn Marino  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15*86d7f5d3SJohn Marino  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16*86d7f5d3SJohn Marino  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17*86d7f5d3SJohn Marino  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18*86d7f5d3SJohn Marino  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19*86d7f5d3SJohn Marino  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20*86d7f5d3SJohn Marino  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21*86d7f5d3SJohn Marino  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22*86d7f5d3SJohn Marino  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23*86d7f5d3SJohn Marino  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24*86d7f5d3SJohn Marino  * SUCH DAMAGE.
25*86d7f5d3SJohn Marino  *
26*86d7f5d3SJohn Marino  *	$FreeBSD: src/sys/dev/mlx/mlxio.h,v 1.1.2.3 2001/06/25 04:37:51 msmith Exp $
27*86d7f5d3SJohn Marino  *	$DragonFly: src/sys/dev/raid/mlx/mlxio.h,v 1.2 2003/06/17 04:28:28 dillon Exp $
28*86d7f5d3SJohn Marino  */
29*86d7f5d3SJohn Marino 
30*86d7f5d3SJohn Marino #include <sys/ioccom.h>
31*86d7f5d3SJohn Marino 
32*86d7f5d3SJohn Marino /*
33*86d7f5d3SJohn Marino  * System Disk ioctls
34*86d7f5d3SJohn Marino  */
35*86d7f5d3SJohn Marino 
36*86d7f5d3SJohn Marino /* system disk status values */
37*86d7f5d3SJohn Marino #define MLX_SYSD_ONLINE		0x03
38*86d7f5d3SJohn Marino #define MLX_SYSD_CRITICAL	0x04
39*86d7f5d3SJohn Marino #define MLX_SYSD_OFFLINE	0xff
40*86d7f5d3SJohn Marino 
41*86d7f5d3SJohn Marino #define MLXD_STATUS		_IOR ('M', 100, int)
42*86d7f5d3SJohn Marino #define MLXD_CHECKASYNC		_IOR ('M', 101, int)	/* command result returned in argument */
43*86d7f5d3SJohn Marino 
44*86d7f5d3SJohn Marino /*
45*86d7f5d3SJohn Marino  * Controller ioctls
46*86d7f5d3SJohn Marino  */
47*86d7f5d3SJohn Marino struct mlx_pause
48*86d7f5d3SJohn Marino {
49*86d7f5d3SJohn Marino     int		mp_which;
50*86d7f5d3SJohn Marino #define MLX_PAUSE_ALL		0xff
51*86d7f5d3SJohn Marino #define MLX_PAUSE_CANCEL	0x00
52*86d7f5d3SJohn Marino     int		mp_when;
53*86d7f5d3SJohn Marino     int		mp_howlong;
54*86d7f5d3SJohn Marino };
55*86d7f5d3SJohn Marino 
56*86d7f5d3SJohn Marino struct mlx_usercommand
57*86d7f5d3SJohn Marino {
58*86d7f5d3SJohn Marino     /* data buffer */
59*86d7f5d3SJohn Marino     size_t	mu_datasize;	/* size of databuffer */
60*86d7f5d3SJohn Marino     void	*mu_buf;	/* address in userspace of databuffer */
61*86d7f5d3SJohn Marino     int		mu_bufptr;	/* offset into command mailbox to place databuffer address */
62*86d7f5d3SJohn Marino 
63*86d7f5d3SJohn Marino     /* command */
64*86d7f5d3SJohn Marino     u_int16_t	mu_status;	/* command status returned */
65*86d7f5d3SJohn Marino     u_int8_t	mu_command[16];	/* command mailbox contents */
66*86d7f5d3SJohn Marino 
67*86d7f5d3SJohn Marino     /* wrapper */
68*86d7f5d3SJohn Marino     int		mu_error;	/* result of submission to driver */
69*86d7f5d3SJohn Marino 
70*86d7f5d3SJohn Marino };
71*86d7f5d3SJohn Marino 
72*86d7f5d3SJohn Marino struct mlx_rebuild_request
73*86d7f5d3SJohn Marino {
74*86d7f5d3SJohn Marino     int		rr_channel;
75*86d7f5d3SJohn Marino     int		rr_target;
76*86d7f5d3SJohn Marino     int		rr_status;
77*86d7f5d3SJohn Marino };
78*86d7f5d3SJohn Marino 
79*86d7f5d3SJohn Marino struct mlx_rebuild_status
80*86d7f5d3SJohn Marino {
81*86d7f5d3SJohn Marino     u_int16_t	rs_code;
82*86d7f5d3SJohn Marino #define MLX_REBUILDSTAT_REBUILDCHECK	0x0000
83*86d7f5d3SJohn Marino #define MLX_REBUILDSTAT_ADDCAPACITY	0x0400
84*86d7f5d3SJohn Marino #define MLX_REBUILDSTAT_ADDCAPACITYINIT	0x0500
85*86d7f5d3SJohn Marino #define MLX_REBUILDSTAT_IDLE		0xffff
86*86d7f5d3SJohn Marino     u_int16_t	rs_drive;
87*86d7f5d3SJohn Marino     int		rs_size;
88*86d7f5d3SJohn Marino     int		rs_remaining;
89*86d7f5d3SJohn Marino };
90*86d7f5d3SJohn Marino 
91*86d7f5d3SJohn Marino #define MLX_NEXT_CHILD		_IOWR('M', 0, int)
92*86d7f5d3SJohn Marino #define MLX_RESCAN_DRIVES	_IO  ('M', 1)
93*86d7f5d3SJohn Marino #define MLX_DETACH_DRIVE	_IOW ('M', 2, int)
94*86d7f5d3SJohn Marino #define MLX_PAUSE_CHANNEL	_IOW ('M', 3, struct mlx_pause)
95*86d7f5d3SJohn Marino #define MLX_COMMAND		_IOWR('M', 4, struct mlx_usercommand)
96*86d7f5d3SJohn Marino #define MLX_REBUILDASYNC	_IOWR('M', 5, struct mlx_rebuild_request)
97*86d7f5d3SJohn Marino #define MLX_REBUILDSTAT		_IOR ('M', 6, struct mlx_rebuild_status)
98*86d7f5d3SJohn Marino #define MLX_GET_SYSDRIVE	_IOWR('M', 7, int)
99