xref: /minix3/sys/dev/pci/mlyreg.h (revision 7eb99bda90fc3b15ed07bfd8809650d0818ad5f7)
1*7eb99bdaSLionel Sambuc /*	$NetBSD: mlyreg.h,v 1.5 2008/09/08 23:36:54 gmcgarry Exp $	*/
2*7eb99bdaSLionel Sambuc 
3*7eb99bdaSLionel Sambuc /*-
4*7eb99bdaSLionel Sambuc  * Copyright (c) 2001 The NetBSD Foundation, Inc.
5*7eb99bdaSLionel Sambuc  * All rights reserved.
6*7eb99bdaSLionel Sambuc  *
7*7eb99bdaSLionel Sambuc  * This code is derived from software contributed to The NetBSD Foundation
8*7eb99bdaSLionel Sambuc  * by Andrew Doran, Thor Lancelot Simon, and Eric Haszlakiewicz.
9*7eb99bdaSLionel Sambuc  *
10*7eb99bdaSLionel Sambuc  * Redistribution and use in source and binary forms, with or without
11*7eb99bdaSLionel Sambuc  * modification, are permitted provided that the following conditions
12*7eb99bdaSLionel Sambuc  * are met:
13*7eb99bdaSLionel Sambuc  * 1. Redistributions of source code must retain the above copyright
14*7eb99bdaSLionel Sambuc  *    notice, this list of conditions and the following disclaimer.
15*7eb99bdaSLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright
16*7eb99bdaSLionel Sambuc  *    notice, this list of conditions and the following disclaimer in the
17*7eb99bdaSLionel Sambuc  *    documentation and/or other materials provided with the distribution.
18*7eb99bdaSLionel Sambuc  *
19*7eb99bdaSLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20*7eb99bdaSLionel Sambuc  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21*7eb99bdaSLionel Sambuc  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22*7eb99bdaSLionel Sambuc  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23*7eb99bdaSLionel Sambuc  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24*7eb99bdaSLionel Sambuc  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25*7eb99bdaSLionel Sambuc  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*7eb99bdaSLionel Sambuc  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27*7eb99bdaSLionel Sambuc  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28*7eb99bdaSLionel Sambuc  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29*7eb99bdaSLionel Sambuc  * POSSIBILITY OF SUCH DAMAGE.
30*7eb99bdaSLionel Sambuc  */
31*7eb99bdaSLionel Sambuc 
32*7eb99bdaSLionel Sambuc /*-
33*7eb99bdaSLionel Sambuc  * Copyright (c) 2000 Michael Smith
34*7eb99bdaSLionel Sambuc  * Copyright (c) 2000 BSDi
35*7eb99bdaSLionel Sambuc  * All rights reserved.
36*7eb99bdaSLionel Sambuc  *
37*7eb99bdaSLionel Sambuc  * Redistribution and use in source and binary forms, with or without
38*7eb99bdaSLionel Sambuc  * modification, are permitted provided that the following conditions
39*7eb99bdaSLionel Sambuc  * are met:
40*7eb99bdaSLionel Sambuc  * 1. Redistributions of source code must retain the above copyright
41*7eb99bdaSLionel Sambuc  *    notice, this list of conditions and the following disclaimer.
42*7eb99bdaSLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright
43*7eb99bdaSLionel Sambuc  *    notice, this list of conditions and the following disclaimer in the
44*7eb99bdaSLionel Sambuc  *    documentation and/or other materials provided with the distribution.
45*7eb99bdaSLionel Sambuc  *
46*7eb99bdaSLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
47*7eb99bdaSLionel Sambuc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48*7eb99bdaSLionel Sambuc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49*7eb99bdaSLionel Sambuc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
50*7eb99bdaSLionel Sambuc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51*7eb99bdaSLionel Sambuc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
52*7eb99bdaSLionel Sambuc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53*7eb99bdaSLionel Sambuc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54*7eb99bdaSLionel Sambuc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55*7eb99bdaSLionel Sambuc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56*7eb99bdaSLionel Sambuc  * SUCH DAMAGE.
57*7eb99bdaSLionel Sambuc  *
58*7eb99bdaSLionel Sambuc  * from FreeBSD: mlyreg.h,v 1.1 2000/08/23 03:22:39 msmith Exp
59*7eb99bdaSLionel Sambuc  */
60*7eb99bdaSLionel Sambuc 
61*7eb99bdaSLionel Sambuc /*
62*7eb99bdaSLionel Sambuc  * Section numbers in this document refer to the Mylex "Firmware Software Interface"
63*7eb99bdaSLionel Sambuc  * document ('FSI'), revision 0.11 04/11/00 unless otherwise qualified.
64*7eb99bdaSLionel Sambuc  *
65*7eb99bdaSLionel Sambuc  * Reference is made to the Mylex "Programming Guide for 6.x Controllers" document
66*7eb99bdaSLionel Sambuc  * ('PG6'), document #771242 revision 0.02, 04/11/00
67*7eb99bdaSLionel Sambuc  *
68*7eb99bdaSLionel Sambuc  * Note that fields marked N/A are not supported by the PCI controllers, but are
69*7eb99bdaSLionel Sambuc  * defined here to hold place in datastructures that are shared with the SCSI
70*7eb99bdaSLionel Sambuc  * controllers.  Items not relevant to PCI controllers are not described here.
71*7eb99bdaSLionel Sambuc  *
72*7eb99bdaSLionel Sambuc  * Ordering of items in this file is a little odd due to the constraints of
73*7eb99bdaSLionel Sambuc  * nested declarations.
74*7eb99bdaSLionel Sambuc  */
75*7eb99bdaSLionel Sambuc 
76*7eb99bdaSLionel Sambuc #ifndef _PCI_MLYREG_H_
77*7eb99bdaSLionel Sambuc #define	_PCI_MLYREG_H_
78*7eb99bdaSLionel Sambuc 
79*7eb99bdaSLionel Sambuc /*
80*7eb99bdaSLionel Sambuc  * 2.1 (Scatter Gather List Format)
81*7eb99bdaSLionel Sambuc  */
82*7eb99bdaSLionel Sambuc struct mly_sg_entry {
83*7eb99bdaSLionel Sambuc 	u_int64_t	physaddr;
84*7eb99bdaSLionel Sambuc 	u_int64_t	length;
85*7eb99bdaSLionel Sambuc } __packed;
86*7eb99bdaSLionel Sambuc 
87*7eb99bdaSLionel Sambuc /*
88*7eb99bdaSLionel Sambuc  * 5.2 System Device Access
89*7eb99bdaSLionel Sambuc  *
90*7eb99bdaSLionel Sambuc  * This is corroborated by the layout of the MDACIOCTL_GETCONTROLLERINFO data
91*7eb99bdaSLionel Sambuc  * in 21.8
92*7eb99bdaSLionel Sambuc  */
93*7eb99bdaSLionel Sambuc #define	MLY_MAX_CHANNELS	6
94*7eb99bdaSLionel Sambuc #define	MLY_MAX_TARGETS		16
95*7eb99bdaSLionel Sambuc #define	MLY_MAX_LUNS		1
96*7eb99bdaSLionel Sambuc 
97*7eb99bdaSLionel Sambuc /*
98*7eb99bdaSLionel Sambuc  * 8.1 Different Device States
99*7eb99bdaSLionel Sambuc  */
100*7eb99bdaSLionel Sambuc #define	MLY_DEVICE_STATE_OFFLINE	0x08	/* DEAD/OFFLINE */
101*7eb99bdaSLionel Sambuc #define	MLY_DEVICE_STATE_UNCONFIGURED	0x00
102*7eb99bdaSLionel Sambuc #define	MLY_DEVICE_STATE_ONLINE		0x01
103*7eb99bdaSLionel Sambuc #define	MLY_DEVICE_STATE_CRITICAL	0x09
104*7eb99bdaSLionel Sambuc #define	MLY_DEVICE_STATE_WRITEONLY	0x03
105*7eb99bdaSLionel Sambuc #define	MLY_DEVICE_STATE_STANDBY	0x21
106*7eb99bdaSLionel Sambuc #define	MLY_DEVICE_STATE_MISSING	0x04	/* or-ed with (ONLINE or WRITEONLY or STANDBY) */
107*7eb99bdaSLionel Sambuc 
108*7eb99bdaSLionel Sambuc /*
109*7eb99bdaSLionel Sambuc  * 8.2 Device Type Field definitions
110*7eb99bdaSLionel Sambuc  */
111*7eb99bdaSLionel Sambuc #define	MLY_DEVICE_TYPE_RAID0		0x0	/* RAID 0 */
112*7eb99bdaSLionel Sambuc #define	MLY_DEVICE_TYPE_RAID1		0x1	/* RAID 1 */
113*7eb99bdaSLionel Sambuc #define	MLY_DEVICE_TYPE_RAID3		0x3	/* RAID 3 right asymmetric parity */
114*7eb99bdaSLionel Sambuc #define	MLY_DEVICE_TYPE_RAID5		0x5	/* RAID 5 right asymmetric parity */
115*7eb99bdaSLionel Sambuc #define	MLY_DEVICE_TYPE_RAID6		0x6	/* RAID 6 (Mylex RAID 6) */
116*7eb99bdaSLionel Sambuc #define	MLY_DEVICE_TYPE_RAID7		0x7	/* RAID 7 (JBOD) */
117*7eb99bdaSLionel Sambuc #define	MLY_DEVICE_TYPE_NEWSPAN		0x8	/* New Mylex SPAN */
118*7eb99bdaSLionel Sambuc #define	MLY_DEVICE_TYPE_RAID3F		0x9	/* RAID 3 fixed parity */
119*7eb99bdaSLionel Sambuc #define	MLY_DEVICE_TYPE_RAID3L		0xb	/* RAID 3 left symmetric parity */
120*7eb99bdaSLionel Sambuc #define	MLY_DEVICE_TYPE_SPAN		0xc	/* current spanning implementation */
121*7eb99bdaSLionel Sambuc #define	MLY_DEVICE_TYPE_RAID5L		0xd	/* RAID 5 left symmetric parity */
122*7eb99bdaSLionel Sambuc #define	MLY_DEVICE_TYPE_RAIDE		0xe	/* RAID E (concatenation) */
123*7eb99bdaSLionel Sambuc #define	MLY_DEVICE_TYPE_PHYSICAL	0xf	/* physical device */
124*7eb99bdaSLionel Sambuc 
125*7eb99bdaSLionel Sambuc /*
126*7eb99bdaSLionel Sambuc  * 8.3 Stripe Size
127*7eb99bdaSLionel Sambuc  */
128*7eb99bdaSLionel Sambuc #define	MLY_STRIPE_ZERO		0x0	/* no stripe (RAID 1, RAID 7, etc) */
129*7eb99bdaSLionel Sambuc #define	MLY_STRIPE_512b		0x1
130*7eb99bdaSLionel Sambuc #define	MLY_STRIPE_1k		0x2
131*7eb99bdaSLionel Sambuc #define	MLY_STRIPE_2k		0x3
132*7eb99bdaSLionel Sambuc #define	MLY_STRIPE_4k		0x4
133*7eb99bdaSLionel Sambuc #define	MLY_STRIPE_8k		0x5
134*7eb99bdaSLionel Sambuc #define	MLY_STRIPE_16k		0x6
135*7eb99bdaSLionel Sambuc #define	MLY_STRIPE_32k		0x7
136*7eb99bdaSLionel Sambuc #define	MLY_STRIPE_64k		0x8
137*7eb99bdaSLionel Sambuc #define	MLY_STRIPE_128k		0x9
138*7eb99bdaSLionel Sambuc #define	MLY_STRIPE_256k		0xa
139*7eb99bdaSLionel Sambuc #define	MLY_STRIPE_512k		0xb
140*7eb99bdaSLionel Sambuc #define	MLY_STRIPE_1m		0xc
141*7eb99bdaSLionel Sambuc 
142*7eb99bdaSLionel Sambuc /*
143*7eb99bdaSLionel Sambuc  * 8.4 Cacheline Size
144*7eb99bdaSLionel Sambuc  */
145*7eb99bdaSLionel Sambuc #define	MLY_CACHELINE_ZERO	0x0	/* caching cannot be enabled */
146*7eb99bdaSLionel Sambuc #define	MLY_CACHELINE_512b	0x1
147*7eb99bdaSLionel Sambuc #define	MLY_CACHELINE_1k	0x2
148*7eb99bdaSLionel Sambuc #define	MLY_CACHELINE_2k	0x3
149*7eb99bdaSLionel Sambuc #define	MLY_CACHELINE_4k	0x4
150*7eb99bdaSLionel Sambuc #define	MLY_CACHELINE_8k	0x5
151*7eb99bdaSLionel Sambuc #define	MLY_CACHELINE_16k	0x6
152*7eb99bdaSLionel Sambuc #define	MLY_CACHELINE_32k	0x7
153*7eb99bdaSLionel Sambuc #define	MLY_CACHELINE_64k	0x8
154*7eb99bdaSLionel Sambuc 
155*7eb99bdaSLionel Sambuc /*
156*7eb99bdaSLionel Sambuc  * 8.5 Read/Write control
157*7eb99bdaSLionel Sambuc  */
158*7eb99bdaSLionel Sambuc #define	MLY_RWCtl_INITTED	(1<<7)	/* if set, the logical device is initialised */
159*7eb99bdaSLionel Sambuc 			/* write control */
160*7eb99bdaSLionel Sambuc #define	MLY_RWCtl_WCD		(0)	/* write cache disabled */
161*7eb99bdaSLionel Sambuc #define	MLY_RWCtl_WDISABLE	(1<<3)	/* writing disabled */
162*7eb99bdaSLionel Sambuc #define	MLY_RWCtl_WCE		(2<<3)	/* write cache enabled */
163*7eb99bdaSLionel Sambuc #define	MLY_RWCtl_IWCE		(3<<3)	/* intelligent write cache enabled */
164*7eb99bdaSLionel Sambuc 			/* read control */
165*7eb99bdaSLionel Sambuc #define	MLY_RWCtl_RCD		(0)	/* read cache is disabled */
166*7eb99bdaSLionel Sambuc #define	MLY_RWCtl_RCE		(1)	/* read cache enabled */
167*7eb99bdaSLionel Sambuc #define	MLY_RWCtl_RAHEAD	(2)	/* readahead enabled */
168*7eb99bdaSLionel Sambuc #define	MLY_RWCtl_IRAHEAD	(3)	/* intelligent readahead enabled */
169*7eb99bdaSLionel Sambuc 
170*7eb99bdaSLionel Sambuc /*
171*7eb99bdaSLionel Sambuc  * 9.0 LUN Map Format
172*7eb99bdaSLionel Sambuc  */
173*7eb99bdaSLionel Sambuc struct mly_lun_map {
174*7eb99bdaSLionel Sambuc 	u_int8_t	res1:4;
175*7eb99bdaSLionel Sambuc 	u_int8_t	host_port_mapped:1;	/* this system drive visibile to host on this controller/port combination */
176*7eb99bdaSLionel Sambuc 	u_int8_t	tid_valid:1;		/* target ID valid */
177*7eb99bdaSLionel Sambuc 	u_int8_t	hid_valid:1;		/* host ID valid */
178*7eb99bdaSLionel Sambuc 	u_int8_t	lun_valid:1;		/* LUN valid */
179*7eb99bdaSLionel Sambuc 	u_int8_t	res2;
180*7eb99bdaSLionel Sambuc 	u_int8_t	lun;			/* LUN */
181*7eb99bdaSLionel Sambuc 	u_int8_t	tid;			/* TID */
182*7eb99bdaSLionel Sambuc 	u_int8_t	hid[32];		/* HID (one bit for each host) */
183*7eb99bdaSLionel Sambuc } __packed;
184*7eb99bdaSLionel Sambuc 
185*7eb99bdaSLionel Sambuc /*
186*7eb99bdaSLionel Sambuc  * 10.1 Controller Parameters
187*7eb99bdaSLionel Sambuc  */
188*7eb99bdaSLionel Sambuc struct mly_param_controller {
189*7eb99bdaSLionel Sambuc 	u_int8_t	rdahen:1;				/* N/A */
190*7eb99bdaSLionel Sambuc 	u_int8_t	bilodly:1;				/* N/A */
191*7eb99bdaSLionel Sambuc 	u_int8_t   	fua_disable:1;
192*7eb99bdaSLionel Sambuc 	u_int8_t	reass1s:1;				/* N/A */
193*7eb99bdaSLionel Sambuc 	u_int8_t	truvrfy:1;				/* N/A */
194*7eb99bdaSLionel Sambuc 	u_int8_t	dwtvrfy:1;				/* N/A */
195*7eb99bdaSLionel Sambuc 	u_int8_t	background_initialisation:1;
196*7eb99bdaSLionel Sambuc 	u_int8_t	clustering:1;				/* N/A */
197*7eb99bdaSLionel Sambuc 
198*7eb99bdaSLionel Sambuc 	u_int8_t	bios_disable:1;
199*7eb99bdaSLionel Sambuc 	u_int8_t   	boot_from_cdrom:1;
200*7eb99bdaSLionel Sambuc 	u_int8_t	drive_coercion:1;
201*7eb99bdaSLionel Sambuc 	u_int8_t	write_same_disable:1;
202*7eb99bdaSLionel Sambuc 	u_int8_t	hba_mode:1;				/* N/A */
203*7eb99bdaSLionel Sambuc 	u_int8_t	bios_geometry:2;
204*7eb99bdaSLionel Sambuc #define	MLY_BIOSGEOM_2G	0x0
205*7eb99bdaSLionel Sambuc #define	MLY_BIOSGEOM_8G	0x1
206*7eb99bdaSLionel Sambuc 	u_int8_t	res1:1;					/* N/A */
207*7eb99bdaSLionel Sambuc 
208*7eb99bdaSLionel Sambuc 	u_int8_t	res2[2];				/* N/A */
209*7eb99bdaSLionel Sambuc 
210*7eb99bdaSLionel Sambuc 	u_int8_t	v_dec:1;
211*7eb99bdaSLionel Sambuc 	u_int8_t	safte:1;				/* N/A */
212*7eb99bdaSLionel Sambuc 	u_int8_t	ses:1;					/* N/A */
213*7eb99bdaSLionel Sambuc 	u_int8_t	res3:2;					/* N/A */
214*7eb99bdaSLionel Sambuc 	u_int8_t	v_arm:1;
215*7eb99bdaSLionel Sambuc 	u_int8_t	v_ofm:1;
216*7eb99bdaSLionel Sambuc 	u_int8_t	res4:1;					/* N/A */
217*7eb99bdaSLionel Sambuc 
218*7eb99bdaSLionel Sambuc 	u_int8_t	rebuild_check_rate;
219*7eb99bdaSLionel Sambuc 	u_int8_t	cache_line_size;			/* see 8.4 */
220*7eb99bdaSLionel Sambuc 	u_int8_t	oem_code;
221*7eb99bdaSLionel Sambuc #define	MLY_OEM_MYLEX	0x00
222*7eb99bdaSLionel Sambuc #define	MLY_OEM_IBM	0x08
223*7eb99bdaSLionel Sambuc #define	MLY_OEM_HP	0x0a
224*7eb99bdaSLionel Sambuc #define	MLY_OEM_DEC	0x0c
225*7eb99bdaSLionel Sambuc #define	MLY_OEM_SIEMENS	0x10
226*7eb99bdaSLionel Sambuc #define	MLY_OEM_INTEL	0x12
227*7eb99bdaSLionel Sambuc 	u_int8_t	spinup_mode;
228*7eb99bdaSLionel Sambuc #define	MLY_SPIN_AUTO		0
229*7eb99bdaSLionel Sambuc #define	MLY_SPIN_PWRSPIN	1
230*7eb99bdaSLionel Sambuc #define	MLY_SPIN_WSSUSPIN	2
231*7eb99bdaSLionel Sambuc 	u_int8_t	spinup_devices;
232*7eb99bdaSLionel Sambuc 	u_int8_t	spinup_interval;
233*7eb99bdaSLionel Sambuc 	u_int8_t	spinup_wait_time;
234*7eb99bdaSLionel Sambuc 
235*7eb99bdaSLionel Sambuc 	u_int8_t	res5:3;					/* N/A */
236*7eb99bdaSLionel Sambuc 	u_int8_t	vutursns:1;				/* N/A */
237*7eb99bdaSLionel Sambuc 	u_int8_t	dccfil:1;				/* N/A */
238*7eb99bdaSLionel Sambuc 	u_int8_t	nopause:1;				/* N/A */
239*7eb99bdaSLionel Sambuc 	u_int8_t	disqfull:1;				/* N/A */
240*7eb99bdaSLionel Sambuc 	u_int8_t	disbusy:1;				/* N/A */
241*7eb99bdaSLionel Sambuc 
242*7eb99bdaSLionel Sambuc 	u_int8_t	res6:2;					/* N/A */
243*7eb99bdaSLionel Sambuc 	u_int8_t	failover_node_name;			/* N/A */
244*7eb99bdaSLionel Sambuc 	u_int8_t	res7:1;					/* N/A */
245*7eb99bdaSLionel Sambuc 	u_int8_t	ftopo:3;				/* N/A */
246*7eb99bdaSLionel Sambuc 	u_int8_t	disable_ups:1;				/* N/A */
247*7eb99bdaSLionel Sambuc 
248*7eb99bdaSLionel Sambuc 	u_int8_t	res8:1;					/* N/A */
249*7eb99bdaSLionel Sambuc 	u_int8_t	propagate_reset:1;			/* N/A */
250*7eb99bdaSLionel Sambuc 	u_int8_t	nonstd_mp_reset:1;			/* N/A */
251*7eb99bdaSLionel Sambuc 	u_int8_t	res9:5;					/* N/A */
252*7eb99bdaSLionel Sambuc 
253*7eb99bdaSLionel Sambuc 	u_int8_t	res10;					/* N/A */
254*7eb99bdaSLionel Sambuc 	u_int8_t	serial_port_baud_rate;			/* N/A */
255*7eb99bdaSLionel Sambuc 	u_int8_t	serial_port_control;			/* N/A */
256*7eb99bdaSLionel Sambuc 	u_int8_t	change_stripe_ok_developer_flag_only;	/* N/A */
257*7eb99bdaSLionel Sambuc 
258*7eb99bdaSLionel Sambuc 	u_int8_t	small_large_host_transfers:2;		/* N/A */
259*7eb99bdaSLionel Sambuc 	u_int8_t	frame_control:2;			/* N/A */
260*7eb99bdaSLionel Sambuc 	u_int8_t	pci_latency_control:2;			/* N/A */
261*7eb99bdaSLionel Sambuc 	u_int8_t	treat_lip_as_reset:1;			/* N/A */
262*7eb99bdaSLionel Sambuc 	u_int8_t	res11:1;				/* N/A */
263*7eb99bdaSLionel Sambuc 
264*7eb99bdaSLionel Sambuc 	u_int8_t	ms_autorest:1;				/* N/A */
265*7eb99bdaSLionel Sambuc 	u_int8_t	res12:7;				/* N/A */
266*7eb99bdaSLionel Sambuc 
267*7eb99bdaSLionel Sambuc 	u_int8_t	ms_aa_fsim:1;				/* N/A */
268*7eb99bdaSLionel Sambuc 	u_int8_t	ms_aa_ccach:1;				/* N/A */
269*7eb99bdaSLionel Sambuc 	u_int8_t	ms_aa_fault_signals:1;			/* N/A */
270*7eb99bdaSLionel Sambuc 	u_int8_t	ms_aa_c4_faults:1;			/* N/A */
271*7eb99bdaSLionel Sambuc 	u_int8_t	ms_aa_host_reset_delay_mask:4;		/* N/A */
272*7eb99bdaSLionel Sambuc 
273*7eb99bdaSLionel Sambuc 	u_int8_t	ms_flg_simplex_no_rstcom:1;		/* N/A */
274*7eb99bdaSLionel Sambuc 	u_int8_t	res13:7;				/* N/A */
275*7eb99bdaSLionel Sambuc 
276*7eb99bdaSLionel Sambuc 	u_int8_t	res14;					/* N/A */
277*7eb99bdaSLionel Sambuc 	u_int8_t	hardloopid[2][2];			/* N/A */
278*7eb99bdaSLionel Sambuc 	u_int8_t	ctrlname[2][16+1];			/* N/A */
279*7eb99bdaSLionel Sambuc 	u_int8_t	initiator_id;
280*7eb99bdaSLionel Sambuc 	u_int8_t	startup_option;
281*7eb99bdaSLionel Sambuc #define	MLY_STARTUP_IF_NO_CHANGE	0x0
282*7eb99bdaSLionel Sambuc #define	MLY_STARTUP_IF_NO_LUN_CHANGE	0x1
283*7eb99bdaSLionel Sambuc #define	MLY_STARTUP_IF_NO_LUN_OFFLINE	0x2
284*7eb99bdaSLionel Sambuc #define	MLY_STARTUP_IF_LUN0_NO_CHANGE	0x3
285*7eb99bdaSLionel Sambuc #define	MLY_STARTUP_IF_LUN0_NOT_OFFLINE	0x4
286*7eb99bdaSLionel Sambuc #define	MLY_STARTUP_ALWAYS		0x5
287*7eb99bdaSLionel Sambuc 
288*7eb99bdaSLionel Sambuc 	u_int8_t	res15[62];
289*7eb99bdaSLionel Sambuc } __packed__;
290*7eb99bdaSLionel Sambuc 
291*7eb99bdaSLionel Sambuc /*
292*7eb99bdaSLionel Sambuc  * 10.2 Physical Device Parameters
293*7eb99bdaSLionel Sambuc  */
294*7eb99bdaSLionel Sambuc struct mly_param_physical_device {
295*7eb99bdaSLionel Sambuc 	u_int16_t	tags;
296*7eb99bdaSLionel Sambuc 	u_int16_t	speed;
297*7eb99bdaSLionel Sambuc 	u_int8_t	width;
298*7eb99bdaSLionel Sambuc 	u_int8_t	combing:1;
299*7eb99bdaSLionel Sambuc 	u_int8_t	res1:7;
300*7eb99bdaSLionel Sambuc 	u_int8_t	res2[3];
301*7eb99bdaSLionel Sambuc } __packed;
302*7eb99bdaSLionel Sambuc 
303*7eb99bdaSLionel Sambuc /*
304*7eb99bdaSLionel Sambuc  * 10.3 Logical Device Parameters
305*7eb99bdaSLionel Sambuc  */
306*7eb99bdaSLionel Sambuc struct mly_param_logical_device {
307*7eb99bdaSLionel Sambuc 	u_int8_t	type;			/* see 8.2 */
308*7eb99bdaSLionel Sambuc 	u_int8_t	state;			/* see 8.1 */
309*7eb99bdaSLionel Sambuc 	u_int16_t	raid_device;
310*7eb99bdaSLionel Sambuc 	u_int8_t	res1;
311*7eb99bdaSLionel Sambuc 	u_int8_t	bios_geometry;		/* BIOS control word? */
312*7eb99bdaSLionel Sambuc 	u_int8_t	stripe_size;		/* see 8.3 */
313*7eb99bdaSLionel Sambuc 	u_int8_t	read_write_control;	/* see 8.5 */
314*7eb99bdaSLionel Sambuc 	u_int8_t	res2[8];
315*7eb99bdaSLionel Sambuc } __packed;
316*7eb99bdaSLionel Sambuc 
317*7eb99bdaSLionel Sambuc /*
318*7eb99bdaSLionel Sambuc  * 12.3 Health Status Buffer
319*7eb99bdaSLionel Sambuc  *
320*7eb99bdaSLionel Sambuc  * Pad to 128 bytes.
321*7eb99bdaSLionel Sambuc  */
322*7eb99bdaSLionel Sambuc struct mly_health_status {
323*7eb99bdaSLionel Sambuc 	u_int32_t	uptime_us;				/* N/A */
324*7eb99bdaSLionel Sambuc 	u_int32_t	uptime_ms;				/* N/A */
325*7eb99bdaSLionel Sambuc 	u_int32_t	realtime;				/* N/A */
326*7eb99bdaSLionel Sambuc 	u_int32_t	res1;					/* N/A */
327*7eb99bdaSLionel Sambuc 	u_int32_t	change_counter;
328*7eb99bdaSLionel Sambuc 	u_int32_t	res2;					/* N/A */
329*7eb99bdaSLionel Sambuc 	u_int32_t	debug_message_index;			/* N/A */
330*7eb99bdaSLionel Sambuc 	u_int32_t	bios_message_index;			/* N/A */
331*7eb99bdaSLionel Sambuc 	u_int32_t	trace_page;				/* N/A */
332*7eb99bdaSLionel Sambuc 	u_int32_t	profiler_page;				/* N/A */
333*7eb99bdaSLionel Sambuc 	u_int32_t	next_event;
334*7eb99bdaSLionel Sambuc 	u_int8_t	res3[4 + 16 + 64];			/* N/A */
335*7eb99bdaSLionel Sambuc } __packed;
336*7eb99bdaSLionel Sambuc 
337*7eb99bdaSLionel Sambuc /*
338*7eb99bdaSLionel Sambuc  * 14.2 Timeout Bit Format
339*7eb99bdaSLionel Sambuc  */
340*7eb99bdaSLionel Sambuc #define	MLY_TIMEOUT_SECONDS	0x00
341*7eb99bdaSLionel Sambuc #define	MLY_TIMEOUT_MINUTES	0x40
342*7eb99bdaSLionel Sambuc #define	MLY_TIMEOUT_HOURS	0x80
343*7eb99bdaSLionel Sambuc 
344*7eb99bdaSLionel Sambuc /*
345*7eb99bdaSLionel Sambuc  * 14.3 Operation Device
346*7eb99bdaSLionel Sambuc  */
347*7eb99bdaSLionel Sambuc #define	MLY_OPDEVICE_PHYSICAL_DEVICE		0x0
348*7eb99bdaSLionel Sambuc #define	MLY_OPDEVICE_RAID_DEVICE		0x1
349*7eb99bdaSLionel Sambuc #define	MLY_OPDEVICE_PHYSICAL_CHANNEL		0x2
350*7eb99bdaSLionel Sambuc #define	MLY_OPDEVICE_RAID_CHANNEL		0x3
351*7eb99bdaSLionel Sambuc #define	MLY_OPDEVICE_PHYSICAL_CONTROLLER	0x4
352*7eb99bdaSLionel Sambuc #define	MLY_OPDEVICE_RAID_CONTROLLER		0x5
353*7eb99bdaSLionel Sambuc #define	MLY_OPDEVICE_CONFIGURATION_GROUP	0x10
354*7eb99bdaSLionel Sambuc 
355*7eb99bdaSLionel Sambuc /*
356*7eb99bdaSLionel Sambuc  * 14.4 Status Bit Format
357*7eb99bdaSLionel Sambuc  *
358*7eb99bdaSLionel Sambuc  * AKA Status Mailbox Format
359*7eb99bdaSLionel Sambuc  *
360*7eb99bdaSLionel Sambuc  * XXX format conflict between FSI and PG6 over the ordering of the
361*7eb99bdaSLionel Sambuc  * status and sense length fields.
362*7eb99bdaSLionel Sambuc  */
363*7eb99bdaSLionel Sambuc struct mly_status {
364*7eb99bdaSLionel Sambuc 	u_int16_t	command_id;
365*7eb99bdaSLionel Sambuc 	u_int8_t	status;
366*7eb99bdaSLionel Sambuc 	u_int8_t	sense_length;
367*7eb99bdaSLionel Sambuc 	int32_t		residue;
368*7eb99bdaSLionel Sambuc } __packed;
369*7eb99bdaSLionel Sambuc 
370*7eb99bdaSLionel Sambuc /*
371*7eb99bdaSLionel Sambuc  * 14.5 Command Control Bit (CCB) format
372*7eb99bdaSLionel Sambuc  *
373*7eb99bdaSLionel Sambuc  * This byte is unfortunately named.
374*7eb99bdaSLionel Sambuc  */
375*7eb99bdaSLionel Sambuc #define	MLY_CMDCTL_FORCE_UNIT_ACCESS	0x01
376*7eb99bdaSLionel Sambuc #define	MLY_CMDCTL_DISABLE_PAGE_OUT	0x02
377*7eb99bdaSLionel Sambuc #define	MLY_CMDCTL_EXTENDED_SG_TABLE	0x08
378*7eb99bdaSLionel Sambuc #define	MLY_CMDCTL_DATA_DIRECTION	0x10
379*7eb99bdaSLionel Sambuc #define	MLY_CMDCTL_NO_AUTO_SENSE	0x40
380*7eb99bdaSLionel Sambuc #define	MLY_CMDCTL_DISABLE_DISCONNECT	0x80
381*7eb99bdaSLionel Sambuc 
382*7eb99bdaSLionel Sambuc /*
383*7eb99bdaSLionel Sambuc  * 15.0 Commands
384*7eb99bdaSLionel Sambuc  *
385*7eb99bdaSLionel Sambuc  * We use the command names as given by Mylex
386*7eb99bdaSLionel Sambuc  */
387*7eb99bdaSLionel Sambuc #define	MDACMD_MEMCOPY		0x1	/* memory to memory copy */
388*7eb99bdaSLionel Sambuc #define	MDACMD_SCSIPT		0x2	/* SCSI passthrough (small command) */
389*7eb99bdaSLionel Sambuc #define	MDACMD_SCSILCPT		0x3	/* SCSI passthrough (large command) */
390*7eb99bdaSLionel Sambuc #define	MDACMD_SCSI		0x4	/* SCSI command for logical/phyiscal device (small command) */
391*7eb99bdaSLionel Sambuc #define	MDACMD_SCSILC		0x5	/* SCSI command for logical/phyiscal device (large command) */
392*7eb99bdaSLionel Sambuc #define	MDACMD_IOCTL		0x20	/* Management command */
393*7eb99bdaSLionel Sambuc #define	MDACMD_IOCTLCHECK	0x23	/* Validate management command (not implemented) */
394*7eb99bdaSLionel Sambuc 
395*7eb99bdaSLionel Sambuc /*
396*7eb99bdaSLionel Sambuc  * 16.0 IOCTL command
397*7eb99bdaSLionel Sambuc  *
398*7eb99bdaSLionel Sambuc  * We use the IOCTL names as given by Mylex
399*7eb99bdaSLionel Sambuc  * Note that only ioctls supported by the PCI controller family are listed
400*7eb99bdaSLionel Sambuc  */
401*7eb99bdaSLionel Sambuc #define	MDACIOCTL_GETCONTROLLERINFO		0x1
402*7eb99bdaSLionel Sambuc #define	MDACIOCTL_GETLOGDEVINFOVALID		0x3
403*7eb99bdaSLionel Sambuc #define	MDACIOCTL_GETPHYSDEVINFOVALID		0x5
404*7eb99bdaSLionel Sambuc #define	MDACIOCTL_GETCONTROLLERSTATISTICS	0xb
405*7eb99bdaSLionel Sambuc #define	MDACIOCTL_GETLOGDEVSTATISTICS		0xd
406*7eb99bdaSLionel Sambuc #define	MDACIOCTL_GETPHYSDEVSTATISTICS		0xf
407*7eb99bdaSLionel Sambuc #define	MDACIOCTL_GETHEALTHSTATUS		0x11
408*7eb99bdaSLionel Sambuc #define	MDACIOCTL_GETEVENT			0x15
409*7eb99bdaSLionel Sambuc /* flash update */
410*7eb99bdaSLionel Sambuc #define	MDACIOCTL_STOREIMAGE			0x2c
411*7eb99bdaSLionel Sambuc #define	MDACIOCTL_READIMAGE			0x2d
412*7eb99bdaSLionel Sambuc #define	MDACIOCTL_FLASHIMAGES			0x2e
413*7eb99bdaSLionel Sambuc /* battery backup unit */
414*7eb99bdaSLionel Sambuc #define	MDACIOCTL_GET_SUBSYSTEM_DATA		0x70
415*7eb99bdaSLionel Sambuc #define	MDACIOCTL_SET_SUBSYSTEM_DATA		0x71
416*7eb99bdaSLionel Sambuc /* non-data commands */
417*7eb99bdaSLionel Sambuc #define	MDACIOCTL_STARTDISOCVERY		0x81
418*7eb99bdaSLionel Sambuc #define	MDACIOCTL_SETRAIDDEVSTATE		0x82
419*7eb99bdaSLionel Sambuc #define	MDACIOCTL_INITPHYSDEVSTART		0x84
420*7eb99bdaSLionel Sambuc #define	MDACIOCTL_INITPHYSDEVSTOP		0x85
421*7eb99bdaSLionel Sambuc #define	MDACIOCTL_INITRAIDDEVSTART		0x86
422*7eb99bdaSLionel Sambuc #define	MDACIOCTL_INITRAIDDEVSTOP		0x87
423*7eb99bdaSLionel Sambuc #define	MDACIOCTL_REBUILDRAIDDEVSTART		0x88
424*7eb99bdaSLionel Sambuc #define	MDACIOCTL_REBUILDRAIDDEVSTOP		0x89
425*7eb99bdaSLionel Sambuc #define	MDACIOCTL_MAKECONSISTENTDATASTART	0x8a
426*7eb99bdaSLionel Sambuc #define	MDACIOCTL_MAKECONSISTENTDATASTOP	0x8b
427*7eb99bdaSLionel Sambuc #define	MDACIOCTL_CONSISTENCYCHECKSTART		0x8c
428*7eb99bdaSLionel Sambuc #define	MDACIOCTL_CONSISTENCYCHECKSTOP		0x8d
429*7eb99bdaSLionel Sambuc #define	MDACIOCTL_SETMEMORYMAILBOX		0x8e
430*7eb99bdaSLionel Sambuc #define	MDACIOCTL_RESETDEVICE			0x90
431*7eb99bdaSLionel Sambuc #define	MDACIOCTL_FLUSHDEVICEDATA		0x91
432*7eb99bdaSLionel Sambuc #define	MDACIOCTL_PAUSEDEVICE			0x92
433*7eb99bdaSLionel Sambuc #define	MDACIOCTL_UNPAUSEDEVICE			0x93
434*7eb99bdaSLionel Sambuc #define	MDACIOCTL_LOCATEDEVICE			0x94
435*7eb99bdaSLionel Sambuc #define	MDACIOCTL_SETMASTERSLAVEMODE		0x95
436*7eb99bdaSLionel Sambuc #define	MDACIOCTL_SETREALTIMECLOCK		0xac
437*7eb99bdaSLionel Sambuc /* RAID configuration */
438*7eb99bdaSLionel Sambuc #define	MDACIOCTL_CREATENEWCONF			0xc0
439*7eb99bdaSLionel Sambuc #define	MDACIOCTL_DELETERAIDDEV			0xc1
440*7eb99bdaSLionel Sambuc #define	MDACIOCTL_REPLACEINTERNALDEV		0xc2
441*7eb99bdaSLionel Sambuc #define	MDACIOCTL_RENAMERAIDDEV			0xc3
442*7eb99bdaSLionel Sambuc #define	MDACIOCTL_ADDNEWCONF			0xc4
443*7eb99bdaSLionel Sambuc #define	MDACIOCTL_XLATEPHYSDEVTORAIDDEV		0xc5
444*7eb99bdaSLionel Sambuc #define	MDACIOCTL_MORE				0xc6
445*7eb99bdaSLionel Sambuc #define	MDACIOCTL_SETPHYSDEVPARAMETER		0xc8
446*7eb99bdaSLionel Sambuc #define	MDACIOCTL_GETPHYSDEVPARAMETER		0xc9
447*7eb99bdaSLionel Sambuc #define	MDACIOCTL_CLEARCONF			0xca
448*7eb99bdaSLionel Sambuc #define	MDACIOCTL_GETDEVCONFINFO		0xcb
449*7eb99bdaSLionel Sambuc #define	MDACIOCTL_GETGROUPCONFINFO		0xcc
450*7eb99bdaSLionel Sambuc #define	MDACIOCTL_GETFREESPACELIST		0xcd
451*7eb99bdaSLionel Sambuc #define	MDACIOCTL_GETLOGDEVPARAMETER		0xce
452*7eb99bdaSLionel Sambuc #define	MDACIOCTL_SETLOGDEVPARAMETER		0xcf
453*7eb99bdaSLionel Sambuc #define	MDACIOCTL_GETCONTROLLERPARAMETER	0xd0
454*7eb99bdaSLionel Sambuc #define	MDACIOCTL_SETCONTRLLERPARAMETER		0xd1
455*7eb99bdaSLionel Sambuc #define	MDACIOCTL_CLEARCONFSUSPMODE		0xd2
456*7eb99bdaSLionel Sambuc #define	MDACIOCTL_GETBDT_FOR_SYSDRIVE		0xe0
457*7eb99bdaSLionel Sambuc 
458*7eb99bdaSLionel Sambuc /*
459*7eb99bdaSLionel Sambuc  * 17.1.4 Data Transfer Memory Address Without SG List
460*7eb99bdaSLionel Sambuc  */
461*7eb99bdaSLionel Sambuc struct mly_short_transfer {
462*7eb99bdaSLionel Sambuc 	struct mly_sg_entry	sg[2];
463*7eb99bdaSLionel Sambuc } __packed;
464*7eb99bdaSLionel Sambuc 
465*7eb99bdaSLionel Sambuc /*
466*7eb99bdaSLionel Sambuc  * 17.1.5 Data Transfer Memory Address With SG List
467*7eb99bdaSLionel Sambuc  *
468*7eb99bdaSLionel Sambuc  * Note that only the first s/g table is currently used.
469*7eb99bdaSLionel Sambuc  */
470*7eb99bdaSLionel Sambuc struct mly_sg_transfer {
471*7eb99bdaSLionel Sambuc 	u_int16_t	entries[3];
472*7eb99bdaSLionel Sambuc 	u_int16_t	res1;
473*7eb99bdaSLionel Sambuc 	u_int64_t	table_physaddr[3];
474*7eb99bdaSLionel Sambuc } __packed;
475*7eb99bdaSLionel Sambuc 
476*7eb99bdaSLionel Sambuc /*
477*7eb99bdaSLionel Sambuc  * 17.1.3 Data Transfer Memory Address Format
478*7eb99bdaSLionel Sambuc  */
479*7eb99bdaSLionel Sambuc union mly_cmd_transfer {
480*7eb99bdaSLionel Sambuc 	struct mly_short_transfer	direct;
481*7eb99bdaSLionel Sambuc 	struct mly_sg_transfer	indirect;
482*7eb99bdaSLionel Sambuc };
483*7eb99bdaSLionel Sambuc 
484*7eb99bdaSLionel Sambuc /*
485*7eb99bdaSLionel Sambuc  * 21.1  MDACIOCTL_SETREALTIMECLOCK
486*7eb99bdaSLionel Sambuc  * 21.7  MDACIOCTL_GETHEALTHSTATUS
487*7eb99bdaSLionel Sambuc  * 21.8  MDACIOCTL_GETCONTROLLERINFO
488*7eb99bdaSLionel Sambuc  * 21.9  MDACIOCTL_GETLOGDEVINFOVALID
489*7eb99bdaSLionel Sambuc  * 21.10 MDACIOCTL_GETPHYSDEVINFOVALID
490*7eb99bdaSLionel Sambuc  * 21.11 MDACIOCTL_GETPHYSDEVSTATISTICS
491*7eb99bdaSLionel Sambuc  * 21.12 MDACIOCTL_GETLOGDEVSTATISTICS
492*7eb99bdaSLionel Sambuc  * 21.13 MDACIOCTL_GETCONTROLLERSTATISTICS
493*7eb99bdaSLionel Sambuc  * 21.27 MDACIOCTL_GETBDT_FOR_SYSDRIVE
494*7eb99bdaSLionel Sambuc  * 23.4  MDACIOCTL_CREATENEWCONF
495*7eb99bdaSLionel Sambuc  * 23.5  MDACIOCTL_ADDNEWCONF
496*7eb99bdaSLionel Sambuc  * 23.8  MDACIOCTL_GETDEVCONFINFO
497*7eb99bdaSLionel Sambuc  * 23.9  MDACIOCTL_GETFREESPACELIST
498*7eb99bdaSLionel Sambuc  * 24.1  MDACIOCTL_MORE
499*7eb99bdaSLionel Sambuc  * 25.1  MDACIOCTL_GETPHYSDEVPARAMETER
500*7eb99bdaSLionel Sambuc  * 25.2  MDACIOCTL_SETPHYSDEVPARAMETER
501*7eb99bdaSLionel Sambuc  * 25.3  MDACIOCTL_GETLOGDEVPARAMETER
502*7eb99bdaSLionel Sambuc  * 25.4  MDACIOCTL_SETLOGDEVPARAMETER
503*7eb99bdaSLionel Sambuc  * 25.5  MDACIOCTL_GETCONTROLLERPARAMETER
504*7eb99bdaSLionel Sambuc  * 25.6  MDACIOCTL_SETCONTROLLERPARAMETER
505*7eb99bdaSLionel Sambuc  *
506*7eb99bdaSLionel Sambuc  * These commands just transfer data
507*7eb99bdaSLionel Sambuc  */
508*7eb99bdaSLionel Sambuc struct mly_ioctl_param_data {
509*7eb99bdaSLionel Sambuc 	u_int8_t	param[10];
510*7eb99bdaSLionel Sambuc 	union mly_cmd_transfer	transfer;
511*7eb99bdaSLionel Sambuc } __packed;
512*7eb99bdaSLionel Sambuc 
513*7eb99bdaSLionel Sambuc /*
514*7eb99bdaSLionel Sambuc  * 21.2 MDACIOCTL_SETMEMORYMAILBOX
515*7eb99bdaSLionel Sambuc  */
516*7eb99bdaSLionel Sambuc struct mly_ioctl_param_setmemorymailbox {
517*7eb99bdaSLionel Sambuc 	u_int8_t	health_buffer_size;
518*7eb99bdaSLionel Sambuc 	u_int8_t	res1;
519*7eb99bdaSLionel Sambuc 	u_int64_t	health_buffer_physaddr;
520*7eb99bdaSLionel Sambuc 	u_int64_t	command_mailbox_physaddr;
521*7eb99bdaSLionel Sambuc 	u_int64_t	status_mailbox_physaddr;
522*7eb99bdaSLionel Sambuc 	u_int64_t	res2[2];
523*7eb99bdaSLionel Sambuc } __packed;
524*7eb99bdaSLionel Sambuc 
525*7eb99bdaSLionel Sambuc /*
526*7eb99bdaSLionel Sambuc  * 21.8.2 MDACIOCTL_GETCONTROLLERINFO: Data Format
527*7eb99bdaSLionel Sambuc  */
528*7eb99bdaSLionel Sambuc struct mly_ioctl_getcontrollerinfo {
529*7eb99bdaSLionel Sambuc 	u_int8_t	res1;					/* N/A */
530*7eb99bdaSLionel Sambuc 	u_int8_t	interface_type;
531*7eb99bdaSLionel Sambuc 	u_int8_t	controller_type;
532*7eb99bdaSLionel Sambuc 	u_int8_t	res2;					/* N/A */
533*7eb99bdaSLionel Sambuc 	u_int16_t	interface_speed;
534*7eb99bdaSLionel Sambuc 	u_int8_t	interface_width;
535*7eb99bdaSLionel Sambuc 	u_int8_t	res3[9];				/* N/A */
536*7eb99bdaSLionel Sambuc 	char		interface_name[16];
537*7eb99bdaSLionel Sambuc 	char		controller_name[16];
538*7eb99bdaSLionel Sambuc 	u_int8_t	res4[16];				/* N/A */
539*7eb99bdaSLionel Sambuc 	/* firmware release information */
540*7eb99bdaSLionel Sambuc 	u_int8_t	fw_major;
541*7eb99bdaSLionel Sambuc 	u_int8_t	fw_minor;
542*7eb99bdaSLionel Sambuc 	u_int8_t	fw_turn;
543*7eb99bdaSLionel Sambuc 	u_int8_t	fw_build;
544*7eb99bdaSLionel Sambuc 	u_int8_t	fw_day;
545*7eb99bdaSLionel Sambuc 	u_int8_t	fw_month;
546*7eb99bdaSLionel Sambuc 	u_int8_t	fw_century;
547*7eb99bdaSLionel Sambuc 	u_int8_t	fw_year;
548*7eb99bdaSLionel Sambuc 	/* hardware release information */
549*7eb99bdaSLionel Sambuc 	u_int8_t	hw_revision;				/* N/A */
550*7eb99bdaSLionel Sambuc 	u_int8_t	res5[3];				/* N/A */
551*7eb99bdaSLionel Sambuc 	u_int8_t	hw_release_day;				/* N/A */
552*7eb99bdaSLionel Sambuc 	u_int8_t	hw_release_month;			/* N/A */
553*7eb99bdaSLionel Sambuc 	u_int8_t	hw_release_century;			/* N/A */
554*7eb99bdaSLionel Sambuc 	u_int8_t	hw_release_year;			/* N/A */
555*7eb99bdaSLionel Sambuc 	/* hardware manufacturing information */
556*7eb99bdaSLionel Sambuc 	u_int8_t	batch_number;				/* N/A */
557*7eb99bdaSLionel Sambuc 	u_int8_t	res6;					/* N/A */
558*7eb99bdaSLionel Sambuc 	u_int8_t	plant_number;
559*7eb99bdaSLionel Sambuc 	u_int8_t	res7;
560*7eb99bdaSLionel Sambuc 	u_int8_t	hw_manuf_day;
561*7eb99bdaSLionel Sambuc 	u_int8_t	hw_manuf_month;
562*7eb99bdaSLionel Sambuc 	u_int8_t	hw_manuf_century;
563*7eb99bdaSLionel Sambuc 	u_int8_t	hw_manuf_year;
564*7eb99bdaSLionel Sambuc 	u_int8_t	max_pdd_per_xldd;
565*7eb99bdaSLionel Sambuc 	u_int8_t	max_ildd_per_xldd;
566*7eb99bdaSLionel Sambuc 	u_int16_t	nvram_size;
567*7eb99bdaSLionel Sambuc 	u_int8_t	max_number_of_xld;			/* N/A */
568*7eb99bdaSLionel Sambuc 	u_int8_t	res8[3];				/* N/A */
569*7eb99bdaSLionel Sambuc 	/* unique information per controller */
570*7eb99bdaSLionel Sambuc 	char		serial_number[16];
571*7eb99bdaSLionel Sambuc 	u_int8_t	res9[16];				/* N/A */
572*7eb99bdaSLionel Sambuc 	/* vendor information */
573*7eb99bdaSLionel Sambuc 	u_int8_t	res10[3];				/* N/A */
574*7eb99bdaSLionel Sambuc 	u_int8_t	oem_information;
575*7eb99bdaSLionel Sambuc 	char		vendor_name[16];			/* N/A */
576*7eb99bdaSLionel Sambuc 	/* other physical/controller/operation information */
577*7eb99bdaSLionel Sambuc 	u_int8_t	bbu_present:1;
578*7eb99bdaSLionel Sambuc 	u_int8_t	active_clustering:1;
579*7eb99bdaSLionel Sambuc 	u_int8_t	res11:6;				/* N/A */
580*7eb99bdaSLionel Sambuc 	u_int8_t	res12[3];				/* N/A */
581*7eb99bdaSLionel Sambuc 	/* physical device scan information */
582*7eb99bdaSLionel Sambuc 	u_int8_t	physical_scan_active:1;
583*7eb99bdaSLionel Sambuc 	u_int8_t	res13:7;				/* N/A */
584*7eb99bdaSLionel Sambuc 	u_int8_t	physical_scan_channel;
585*7eb99bdaSLionel Sambuc 	u_int8_t	physical_scan_target;
586*7eb99bdaSLionel Sambuc 	u_int8_t	physical_scan_lun;
587*7eb99bdaSLionel Sambuc 	/* maximum command data transfer size */
588*7eb99bdaSLionel Sambuc 	u_int16_t	maximum_block_count;
589*7eb99bdaSLionel Sambuc 	u_int16_t	maximum_sg_entries;
590*7eb99bdaSLionel Sambuc 	/* logical/physical device counts */
591*7eb99bdaSLionel Sambuc 	u_int16_t	logical_devices_present;
592*7eb99bdaSLionel Sambuc 	u_int16_t	logical_devices_critical;
593*7eb99bdaSLionel Sambuc 	u_int16_t	logical_devices_offline;
594*7eb99bdaSLionel Sambuc 	u_int16_t	physical_devices_present;
595*7eb99bdaSLionel Sambuc 	u_int16_t	physical_disks_present;
596*7eb99bdaSLionel Sambuc 	u_int16_t	physical_disks_critical;		/* N/A */
597*7eb99bdaSLionel Sambuc 	u_int16_t	physical_disks_offline;
598*7eb99bdaSLionel Sambuc 	u_int16_t	maximum_parallel_commands;
599*7eb99bdaSLionel Sambuc 	/* channel and target ID information */
600*7eb99bdaSLionel Sambuc 	u_int8_t	physical_channels_present;
601*7eb99bdaSLionel Sambuc 	u_int8_t	virtual_channels_present;
602*7eb99bdaSLionel Sambuc 	u_int8_t	physical_channels_possible;
603*7eb99bdaSLionel Sambuc 	u_int8_t	virtual_channels_possible;
604*7eb99bdaSLionel Sambuc 	u_int8_t	maximum_targets_possible[16];		/* N/A (6 and up) */
605*7eb99bdaSLionel Sambuc 	u_int8_t	res14[12];				/* N/A */
606*7eb99bdaSLionel Sambuc 	/* memory/cache information */
607*7eb99bdaSLionel Sambuc 	u_int16_t	memory_size;
608*7eb99bdaSLionel Sambuc 	u_int16_t	cache_size;
609*7eb99bdaSLionel Sambuc 	u_int32_t	valid_cache_size;			/* N/A */
610*7eb99bdaSLionel Sambuc 	u_int32_t	dirty_cache_size;			/* N/A */
611*7eb99bdaSLionel Sambuc 	u_int16_t	memory_speed;
612*7eb99bdaSLionel Sambuc 	u_int8_t	memory_width;
613*7eb99bdaSLionel Sambuc 	u_int8_t	memory_type:5;
614*7eb99bdaSLionel Sambuc 	u_int8_t	res15:1;				/* N/A */
615*7eb99bdaSLionel Sambuc 	u_int8_t	memory_parity:1;
616*7eb99bdaSLionel Sambuc 	u_int8_t	memory_ecc:1;
617*7eb99bdaSLionel Sambuc 	char		memory_information[16];			/* N/A */
618*7eb99bdaSLionel Sambuc 	/* execution memory information */
619*7eb99bdaSLionel Sambuc 	u_int16_t	exmemory_size;
620*7eb99bdaSLionel Sambuc 	u_int16_t	l2cache_size;				/* N/A */
621*7eb99bdaSLionel Sambuc 	u_int8_t	res16[8];				/* N/A */
622*7eb99bdaSLionel Sambuc 	u_int16_t	exmemory_speed;
623*7eb99bdaSLionel Sambuc 	u_int8_t	exmemory_width;
624*7eb99bdaSLionel Sambuc 	u_int8_t	exmemory_type:5;
625*7eb99bdaSLionel Sambuc 	u_int8_t	res17:1;				/* N/A */
626*7eb99bdaSLionel Sambuc 	u_int8_t	exmemory_parity:1;
627*7eb99bdaSLionel Sambuc 	u_int8_t	exmemory_ecc:1;
628*7eb99bdaSLionel Sambuc 	char		exmemory_name[16];			/* N/A */
629*7eb99bdaSLionel Sambuc 	/* CPU information */
630*7eb99bdaSLionel Sambuc 	struct {
631*7eb99bdaSLionel Sambuc 		u_int16_t	speed;
632*7eb99bdaSLionel Sambuc 		u_int8_t	type;
633*7eb99bdaSLionel Sambuc 		u_int8_t	number;
634*7eb99bdaSLionel Sambuc 		u_int8_t	res1[12];			/* N/A */
635*7eb99bdaSLionel Sambuc 		char		name[16];			/* N/A */
636*7eb99bdaSLionel Sambuc 	} cpu[2] __packed;
637*7eb99bdaSLionel Sambuc 	/* debugging/profiling/command time tracing information */
638*7eb99bdaSLionel Sambuc 	u_int16_t	profiling_page;				/* N/A */
639*7eb99bdaSLionel Sambuc 	u_int16_t	profiling_programs;			/* N/A */
640*7eb99bdaSLionel Sambuc 	u_int16_t	time_trace_page;			/* N/A */
641*7eb99bdaSLionel Sambuc 	u_int16_t	time_trace_programs;			/* N/A */
642*7eb99bdaSLionel Sambuc 	u_int8_t	res18[8];				/* N/A */
643*7eb99bdaSLionel Sambuc 	/* error counters on physical devices */
644*7eb99bdaSLionel Sambuc 	u_int16_t	physical_device_bus_resets;		/* N/A */
645*7eb99bdaSLionel Sambuc 	u_int16_t	physical_device_parity_errors;		/* N/A */
646*7eb99bdaSLionel Sambuc 	u_int16_t	physical_device_soft_errors;		/* N/A */
647*7eb99bdaSLionel Sambuc 	u_int16_t	physical_device_commands_failed;	/* N/A */
648*7eb99bdaSLionel Sambuc 	u_int16_t	physical_device_miscellaneous_errors;	/* N/A */
649*7eb99bdaSLionel Sambuc 	u_int16_t	physical_device_command_timeouts;	/* N/A */
650*7eb99bdaSLionel Sambuc 	u_int16_t	physical_device_selection_timeouts;	/* N/A */
651*7eb99bdaSLionel Sambuc 	u_int16_t	physical_device_retries;		/* N/A */
652*7eb99bdaSLionel Sambuc 	u_int16_t	physical_device_aborts;			/* N/A */
653*7eb99bdaSLionel Sambuc 	u_int16_t	physical_device_host_command_aborts;	/* N/A */
654*7eb99bdaSLionel Sambuc 	u_int16_t	physical_device_PFAs_detected;		/* N/A */
655*7eb99bdaSLionel Sambuc 	u_int16_t	physical_device_host_commands_failed;	/* N/A */
656*7eb99bdaSLionel Sambuc 	u_int8_t	res19[8];				/* N/A */
657*7eb99bdaSLionel Sambuc 	/* error counters on logical devices */
658*7eb99bdaSLionel Sambuc 	u_int16_t	logical_device_soft_errors;		/* N/A */
659*7eb99bdaSLionel Sambuc 	u_int16_t	logical_device_commands_failed;		/* N/A */
660*7eb99bdaSLionel Sambuc 	u_int16_t	logical_device_host_command_aborts;	/* N/A */
661*7eb99bdaSLionel Sambuc 	u_int16_t	res20;					/* N/A */
662*7eb99bdaSLionel Sambuc 	/* error counters on controller */
663*7eb99bdaSLionel Sambuc 	u_int16_t	controller_parity_ecc_errors;
664*7eb99bdaSLionel Sambuc 	u_int16_t	controller_host_command_aborts;		/* N/A */
665*7eb99bdaSLionel Sambuc 	u_int8_t	res21[4];				/* N/A */
666*7eb99bdaSLionel Sambuc 	/* long duration activity information */
667*7eb99bdaSLionel Sambuc 	u_int16_t	background_inits_active;
668*7eb99bdaSLionel Sambuc 	u_int16_t	logical_inits_active;
669*7eb99bdaSLionel Sambuc 	u_int16_t	physical_inits_active;
670*7eb99bdaSLionel Sambuc 	u_int16_t	consistency_checks_active;
671*7eb99bdaSLionel Sambuc 	u_int16_t	rebuilds_active;
672*7eb99bdaSLionel Sambuc 	u_int16_t	MORE_active;
673*7eb99bdaSLionel Sambuc 	u_int16_t	patrol_active;				/* N/A */
674*7eb99bdaSLionel Sambuc 	u_int8_t	long_operation_status;			/* N/A */
675*7eb99bdaSLionel Sambuc 	u_int8_t	res22;					/* N/A */
676*7eb99bdaSLionel Sambuc 	/* flash ROM information */
677*7eb99bdaSLionel Sambuc 	u_int8_t	flash_type;				/* N/A */
678*7eb99bdaSLionel Sambuc 	u_int8_t	res23;					/* N/A */
679*7eb99bdaSLionel Sambuc 	u_int16_t	flash_size;
680*7eb99bdaSLionel Sambuc 	u_int32_t	flash_maximum_age;
681*7eb99bdaSLionel Sambuc 	u_int32_t	flash_age;
682*7eb99bdaSLionel Sambuc 	u_int8_t	res24[4];				/* N/A */
683*7eb99bdaSLionel Sambuc 	char		flash_name[16];				/* N/A */
684*7eb99bdaSLionel Sambuc 	/* firmware runtime information */
685*7eb99bdaSLionel Sambuc 	u_int8_t	rebuild_rate;
686*7eb99bdaSLionel Sambuc 	u_int8_t	background_init_rate;
687*7eb99bdaSLionel Sambuc 	u_int8_t	init_rate;
688*7eb99bdaSLionel Sambuc 	u_int8_t	consistency_check_rate;
689*7eb99bdaSLionel Sambuc 	u_int8_t	res25[4];				/* N/A */
690*7eb99bdaSLionel Sambuc 	u_int32_t	maximum_dp;
691*7eb99bdaSLionel Sambuc 	u_int32_t	free_dp;
692*7eb99bdaSLionel Sambuc 	u_int32_t	maximum_iop;
693*7eb99bdaSLionel Sambuc 	u_int32_t	free_iop;
694*7eb99bdaSLionel Sambuc 	u_int16_t	maximum_comb_length;
695*7eb99bdaSLionel Sambuc 	u_int16_t	maximum_configuration_groups;
696*7eb99bdaSLionel Sambuc 	u_int8_t	installation_abort:1;
697*7eb99bdaSLionel Sambuc 	u_int8_t	maintenance:1;
698*7eb99bdaSLionel Sambuc 	u_int8_t	res26:6;				/* N/A */
699*7eb99bdaSLionel Sambuc 	u_int8_t	res27[3];				/* N/A */
700*7eb99bdaSLionel Sambuc 	u_int8_t	res28[32 + 512];			/* N/A */
701*7eb99bdaSLionel Sambuc } __packed;
702*7eb99bdaSLionel Sambuc 
703*7eb99bdaSLionel Sambuc /*
704*7eb99bdaSLionel Sambuc  * 21.9.2 MDACIOCTL_GETLOGDEVINFOVALID
705*7eb99bdaSLionel Sambuc  */
706*7eb99bdaSLionel Sambuc struct mly_ioctl_getlogdevinfovalid {
707*7eb99bdaSLionel Sambuc 	u_int8_t	res1;					/* N/A */
708*7eb99bdaSLionel Sambuc 	u_int8_t	channel;
709*7eb99bdaSLionel Sambuc 	u_int8_t	target;
710*7eb99bdaSLionel Sambuc 	u_int8_t	lun;
711*7eb99bdaSLionel Sambuc 	u_int8_t	state;					/* see 8.1 */
712*7eb99bdaSLionel Sambuc 	u_int8_t	raid_level;				/* see 8.2 */
713*7eb99bdaSLionel Sambuc 	u_int8_t	stripe_size;				/* see 8.3 */
714*7eb99bdaSLionel Sambuc 	u_int8_t	cache_line_size;			/* see 8.4 */
715*7eb99bdaSLionel Sambuc 	u_int8_t	read_write_control;			/* see 8.5 */
716*7eb99bdaSLionel Sambuc 	u_int8_t	consistency_check:1;
717*7eb99bdaSLionel Sambuc 	u_int8_t	rebuild:1;
718*7eb99bdaSLionel Sambuc 	u_int8_t	make_consistent:1;
719*7eb99bdaSLionel Sambuc 	u_int8_t	initialisation:1;
720*7eb99bdaSLionel Sambuc 	u_int8_t	migration:1;
721*7eb99bdaSLionel Sambuc 	u_int8_t	patrol:1;
722*7eb99bdaSLionel Sambuc 	u_int8_t	res2:2;					/* N/A */
723*7eb99bdaSLionel Sambuc 	u_int8_t	ar5_limit;
724*7eb99bdaSLionel Sambuc 	u_int8_t	ar5_algo;
725*7eb99bdaSLionel Sambuc 	u_int16_t	logical_device_number;
726*7eb99bdaSLionel Sambuc 	u_int16_t	bios_control;
727*7eb99bdaSLionel Sambuc 	/* erorr counters */
728*7eb99bdaSLionel Sambuc 	u_int16_t	soft_errors;				/* N/A */
729*7eb99bdaSLionel Sambuc 	u_int16_t	commands_failed;			/* N/A */
730*7eb99bdaSLionel Sambuc 	u_int16_t	host_command_aborts;			/* N/A */
731*7eb99bdaSLionel Sambuc 	u_int16_t	deferred_write_errors;			/* N/A */
732*7eb99bdaSLionel Sambuc 	u_int8_t	res3[8];				/* N/A */
733*7eb99bdaSLionel Sambuc 	/* device size information */
734*7eb99bdaSLionel Sambuc 	u_int8_t	res4[2];				/* N/A */
735*7eb99bdaSLionel Sambuc 	u_int16_t	device_block_size;
736*7eb99bdaSLionel Sambuc 	u_int32_t	original_device_size;			/* N/A */
737*7eb99bdaSLionel Sambuc 	u_int32_t	device_size;		/* XXX "blocks or MB" Huh? */
738*7eb99bdaSLionel Sambuc 	u_int8_t	res5[4];				/* N/A */
739*7eb99bdaSLionel Sambuc 	char		device_name[32];			/* N/A */
740*7eb99bdaSLionel Sambuc 	u_int8_t	inquiry[36];
741*7eb99bdaSLionel Sambuc 	u_int8_t	res6[12];				/* N/A */
742*7eb99bdaSLionel Sambuc 	u_int64_t	last_read_block;			/* N/A */
743*7eb99bdaSLionel Sambuc 	u_int64_t	last_written_block;			/* N/A */
744*7eb99bdaSLionel Sambuc 	u_int64_t	consistency_check_block;
745*7eb99bdaSLionel Sambuc 	u_int64_t	rebuild_block;
746*7eb99bdaSLionel Sambuc 	u_int64_t	make_consistent_block;
747*7eb99bdaSLionel Sambuc 	u_int64_t	initialisation_block;
748*7eb99bdaSLionel Sambuc 	u_int64_t	migration_block;
749*7eb99bdaSLionel Sambuc 	u_int64_t	patrol_block;				/* N/A */
750*7eb99bdaSLionel Sambuc 	u_int8_t	res7[64];				/* N/A */
751*7eb99bdaSLionel Sambuc } __packed;
752*7eb99bdaSLionel Sambuc 
753*7eb99bdaSLionel Sambuc /*
754*7eb99bdaSLionel Sambuc  * 21.10.2 MDACIOCTL_GETPHYSDEVINFOVALID: Data Format
755*7eb99bdaSLionel Sambuc  */
756*7eb99bdaSLionel Sambuc struct mly_ioctl_getphysdevinfovalid {
757*7eb99bdaSLionel Sambuc 	u_int8_t	res1;
758*7eb99bdaSLionel Sambuc 	u_int8_t	channel;
759*7eb99bdaSLionel Sambuc 	u_int8_t	target;
760*7eb99bdaSLionel Sambuc 	u_int8_t	lun;
761*7eb99bdaSLionel Sambuc 	u_int8_t	raid_ft:1;			/* configuration status */
762*7eb99bdaSLionel Sambuc 	u_int8_t	res2:1;					/* N/A */
763*7eb99bdaSLionel Sambuc 	u_int8_t	local:1;
764*7eb99bdaSLionel Sambuc 	u_int8_t	res3:5;
765*7eb99bdaSLionel Sambuc 	u_int8_t	host_dead:1;			/* multiple host/controller status *//* N/A */
766*7eb99bdaSLionel Sambuc 	u_int8_t	host_connection_dead:1;			/* N/A */
767*7eb99bdaSLionel Sambuc 	u_int8_t	res4:6;					/* N/A */
768*7eb99bdaSLionel Sambuc 	u_int8_t	state;				/* see 8.1 */
769*7eb99bdaSLionel Sambuc 	u_int8_t	width;
770*7eb99bdaSLionel Sambuc 	u_int16_t	speed;
771*7eb99bdaSLionel Sambuc 	/* multiported physical device information */
772*7eb99bdaSLionel Sambuc 	u_int8_t	ports_available;			/* N/A */
773*7eb99bdaSLionel Sambuc 	u_int8_t	ports_inuse;				/* N/A */
774*7eb99bdaSLionel Sambuc 	u_int8_t	res5[4];
775*7eb99bdaSLionel Sambuc 	u_int8_t	ether_address[16];			/* N/A */
776*7eb99bdaSLionel Sambuc 	u_int16_t	command_tags;
777*7eb99bdaSLionel Sambuc 	u_int8_t	consistency_check:1;			/* N/A */
778*7eb99bdaSLionel Sambuc 	u_int8_t	rebuild:1;				/* N/A */
779*7eb99bdaSLionel Sambuc 	u_int8_t	make_consistent:1;			/* N/A */
780*7eb99bdaSLionel Sambuc 	u_int8_t	initialisation:1;
781*7eb99bdaSLionel Sambuc 	u_int8_t	migration:1;				/* N/A */
782*7eb99bdaSLionel Sambuc 	u_int8_t	patrol:1;				/* N/A */
783*7eb99bdaSLionel Sambuc 	u_int8_t	res6:2;
784*7eb99bdaSLionel Sambuc 	u_int8_t	long_operation_status;			/* N/A */
785*7eb99bdaSLionel Sambuc 	u_int8_t	parity_errors;
786*7eb99bdaSLionel Sambuc 	u_int8_t	soft_errors;
787*7eb99bdaSLionel Sambuc 	u_int8_t	hard_errors;
788*7eb99bdaSLionel Sambuc 	u_int8_t	miscellaneous_errors;
789*7eb99bdaSLionel Sambuc 	u_int8_t	command_timeouts;			/* N/A */
790*7eb99bdaSLionel Sambuc 	u_int8_t	retries;				/* N/A */
791*7eb99bdaSLionel Sambuc 	u_int8_t	aborts;					/* N/A */
792*7eb99bdaSLionel Sambuc 	u_int8_t	PFAs_detected;				/* N/A */
793*7eb99bdaSLionel Sambuc 	u_int8_t	res7[6];
794*7eb99bdaSLionel Sambuc 	u_int16_t	block_size;
795*7eb99bdaSLionel Sambuc 	u_int32_t	original_device_size;		/* XXX "blocks or MB" Huh? */
796*7eb99bdaSLionel Sambuc 	u_int32_t	device_size;			/* XXX "blocks or MB" Huh? */
797*7eb99bdaSLionel Sambuc 	u_int8_t	res8[4];
798*7eb99bdaSLionel Sambuc 	char		name[16];				/* N/A */
799*7eb99bdaSLionel Sambuc 	u_int8_t	res9[16 + 32];
800*7eb99bdaSLionel Sambuc 	u_int8_t	inquiry[36];
801*7eb99bdaSLionel Sambuc 	u_int8_t	res10[12 + 16];
802*7eb99bdaSLionel Sambuc 	u_int64_t	last_read_block;			/* N/A */
803*7eb99bdaSLionel Sambuc 	u_int64_t	last_written_block;			/* N/A */
804*7eb99bdaSLionel Sambuc 	u_int64_t	consistency_check_block;		/* N/A */
805*7eb99bdaSLionel Sambuc 	u_int64_t	rebuild_block;				/* N/A */
806*7eb99bdaSLionel Sambuc 	u_int64_t	make_consistent_block;			/* N/A */
807*7eb99bdaSLionel Sambuc 	u_int64_t	initialisation_block;			/* N/A */
808*7eb99bdaSLionel Sambuc 	u_int64_t	migration_block;			/* N/A */
809*7eb99bdaSLionel Sambuc 	u_int64_t	patrol_block;				/* N/A */
810*7eb99bdaSLionel Sambuc 	u_int8_t	res11[256];
811*7eb99bdaSLionel Sambuc } __packed;
812*7eb99bdaSLionel Sambuc 
813*7eb99bdaSLionel Sambuc union mly_devinfo {
814*7eb99bdaSLionel Sambuc 	struct mly_ioctl_getlogdevinfovalid	logdev;
815*7eb99bdaSLionel Sambuc 	struct mly_ioctl_getphysdevinfovalid	physdev;
816*7eb99bdaSLionel Sambuc };
817*7eb99bdaSLionel Sambuc 
818*7eb99bdaSLionel Sambuc /*
819*7eb99bdaSLionel Sambuc  * 21.11.2 MDACIOCTL_GETPHYSDEVSTATISTICS: Data Format
820*7eb99bdaSLionel Sambuc  * 21.12.2 MDACIOCTL_GETLOGDEVSTATISTICS: Data Format
821*7eb99bdaSLionel Sambuc  */
822*7eb99bdaSLionel Sambuc struct mly_ioctl_getdevstatistics {
823*7eb99bdaSLionel Sambuc 	u_int32_t	uptime_ms;			/* getphysedevstatistics only */
824*7eb99bdaSLionel Sambuc 	u_int8_t	res1[5];				/* N/A */
825*7eb99bdaSLionel Sambuc 	u_int8_t	channel;
826*7eb99bdaSLionel Sambuc 	u_int8_t	target;
827*7eb99bdaSLionel Sambuc 	u_int8_t	lun;
828*7eb99bdaSLionel Sambuc 	u_int16_t	raid_device;			/* getlogdevstatistics only */
829*7eb99bdaSLionel Sambuc 	u_int8_t	res2[2];				/* N/A */
830*7eb99bdaSLionel Sambuc 	/* total read/write performance including cache data */
831*7eb99bdaSLionel Sambuc 	u_int32_t	total_reads;
832*7eb99bdaSLionel Sambuc 	u_int32_t	total_writes;
833*7eb99bdaSLionel Sambuc 	u_int32_t	total_read_size;
834*7eb99bdaSLionel Sambuc 	u_int32_t	total_write_size;
835*7eb99bdaSLionel Sambuc 	/* cache read/write performance */
836*7eb99bdaSLionel Sambuc 	u_int32_t	cache_reads;				/* N/A */
837*7eb99bdaSLionel Sambuc 	u_int32_t	cache_writes;				/* N/A */
838*7eb99bdaSLionel Sambuc 	u_int32_t	cache_read_size;			/* N/A */
839*7eb99bdaSLionel Sambuc 	u_int32_t	cache_write_size;			/* N/A */
840*7eb99bdaSLionel Sambuc 	/* commands active/wait information */
841*7eb99bdaSLionel Sambuc 	u_int32_t	command_waits_done;			/* N/A */
842*7eb99bdaSLionel Sambuc 	u_int16_t	active_commands;			/* N/A */
843*7eb99bdaSLionel Sambuc 	u_int16_t	waiting_commands;			/* N/A */
844*7eb99bdaSLionel Sambuc 	u_int8_t	res3[8];				/* N/A */
845*7eb99bdaSLionel Sambuc } __packed;
846*7eb99bdaSLionel Sambuc 
847*7eb99bdaSLionel Sambuc /*
848*7eb99bdaSLionel Sambuc  * 21.13.2 MDACIOCTL_GETCONTROLLERSTATISTICS: Data Format
849*7eb99bdaSLionel Sambuc  */
850*7eb99bdaSLionel Sambuc struct mly_ioctl_getcontrollerstatistics {
851*7eb99bdaSLionel Sambuc 	u_int32_t	uptime_ms;				/* N/A */
852*7eb99bdaSLionel Sambuc 	u_int8_t	res1[12];				/* N/A */
853*7eb99bdaSLionel Sambuc 	/* target physical device performance data information */
854*7eb99bdaSLionel Sambuc 	u_int32_t	target_physical_device_interrupts;	/* N/A */
855*7eb99bdaSLionel Sambuc 	u_int32_t	target_physical_device_stray_interrupts;/* N/A */
856*7eb99bdaSLionel Sambuc 	u_int8_t	res2[8];				/* N/A */
857*7eb99bdaSLionel Sambuc 	u_int32_t	target_physical_device_reads;		/* N/A */
858*7eb99bdaSLionel Sambuc 	u_int32_t	target_physical_device_writes;		/* N/A */
859*7eb99bdaSLionel Sambuc 	u_int32_t	target_physical_device_read_size;	/* N/A */
860*7eb99bdaSLionel Sambuc 	u_int32_t	target_physical_device_write_size;	/* N/A */
861*7eb99bdaSLionel Sambuc 	/* host system performance data information */
862*7eb99bdaSLionel Sambuc 	u_int32_t	host_system_interrupts;			/* N/A */
863*7eb99bdaSLionel Sambuc 	u_int32_t	host_system_stray_interrupts;		/* N/A */
864*7eb99bdaSLionel Sambuc 	u_int32_t	host_system_sent_interrupts;		/* N/A */
865*7eb99bdaSLionel Sambuc 	u_int8_t	res3[4];				/* N/A */
866*7eb99bdaSLionel Sambuc 	u_int32_t	physical_device_reads;			/* N/A */
867*7eb99bdaSLionel Sambuc 	u_int32_t	physical_device_writes;			/* N/A */
868*7eb99bdaSLionel Sambuc 	u_int32_t	physical_device_read_size;		/* N/A */
869*7eb99bdaSLionel Sambuc 	u_int32_t	physical_device_write_size;		/* N/A */
870*7eb99bdaSLionel Sambuc 	u_int32_t	physical_device_cache_reads;		/* N/A */
871*7eb99bdaSLionel Sambuc 	u_int32_t	physical_device_cache_writes;		/* N/A */
872*7eb99bdaSLionel Sambuc 	u_int32_t	physical_device_cache_read_size;	/* N/A */
873*7eb99bdaSLionel Sambuc 	u_int32_t	physical_device_cache_write_size;	/* N/A */
874*7eb99bdaSLionel Sambuc 	u_int32_t	logical_device_reads;			/* N/A */
875*7eb99bdaSLionel Sambuc 	u_int32_t	logical_device_writes;			/* N/A */
876*7eb99bdaSLionel Sambuc 	u_int32_t	logical_device_read_size;		/* N/A */
877*7eb99bdaSLionel Sambuc 	u_int32_t	logical_device_write_size;		/* N/A */
878*7eb99bdaSLionel Sambuc 	u_int32_t	logical_device_cache_reads;		/* N/A */
879*7eb99bdaSLionel Sambuc 	u_int32_t	logical_device_cache_writes;		/* N/A */
880*7eb99bdaSLionel Sambuc 	u_int32_t	logical_device_cache_read_size;		/* N/A */
881*7eb99bdaSLionel Sambuc 	u_int32_t	logical_device_cache_write_size;	/* N/A */
882*7eb99bdaSLionel Sambuc 	u_int16_t	target_physical_device_commands_active;	/* N/A */
883*7eb99bdaSLionel Sambuc 	u_int16_t	target_physical_device_commands_waiting;/* N/A */
884*7eb99bdaSLionel Sambuc 	u_int16_t	host_system_commands_active;		/* N/A */
885*7eb99bdaSLionel Sambuc 	u_int16_t	host_system_commands_waiting;		/* N/A */
886*7eb99bdaSLionel Sambuc 	u_int8_t	res4[48 + 64];				/* N/A */
887*7eb99bdaSLionel Sambuc } __packed;
888*7eb99bdaSLionel Sambuc 
889*7eb99bdaSLionel Sambuc /*
890*7eb99bdaSLionel Sambuc  * 21.2 MDACIOCTL_SETRAIDDEVSTATE
891*7eb99bdaSLionel Sambuc  */
892*7eb99bdaSLionel Sambuc struct mly_ioctl_param_setraiddevstate {
893*7eb99bdaSLionel Sambuc 	u_int8_t	state;
894*7eb99bdaSLionel Sambuc } __packed;
895*7eb99bdaSLionel Sambuc 
896*7eb99bdaSLionel Sambuc /*
897*7eb99bdaSLionel Sambuc  * 21.27.2 MDACIOCTL_GETBDT_FOR_SYSDRIVE: Data Format
898*7eb99bdaSLionel Sambuc  */
899*7eb99bdaSLionel Sambuc #define	MLY_MAX_BDT_ENTRIES	1022
900*7eb99bdaSLionel Sambuc struct mly_ioctl_getbdt_for_sysdrive {
901*7eb99bdaSLionel Sambuc 	u_int32_t	num_of_bdt_entries;
902*7eb99bdaSLionel Sambuc 	u_int32_t	bad_data_block_address[MLY_MAX_BDT_ENTRIES];
903*7eb99bdaSLionel Sambuc } __packed;
904*7eb99bdaSLionel Sambuc 
905*7eb99bdaSLionel Sambuc /*
906*7eb99bdaSLionel Sambuc  * 22.1 Physical Device Definition (PDD)
907*7eb99bdaSLionel Sambuc  */
908*7eb99bdaSLionel Sambuc struct mly_pdd {
909*7eb99bdaSLionel Sambuc 	u_int8_t	type;				/* see 8.2 */
910*7eb99bdaSLionel Sambuc 	u_int8_t	state;				/* see 8.1 */
911*7eb99bdaSLionel Sambuc 	u_int16_t	raid_device;
912*7eb99bdaSLionel Sambuc 	u_int32_t	device_size;			/* XXX "block or MB" Huh? */
913*7eb99bdaSLionel Sambuc 	u_int8_t	controller;
914*7eb99bdaSLionel Sambuc 	u_int8_t	channel;
915*7eb99bdaSLionel Sambuc 	u_int8_t	target;
916*7eb99bdaSLionel Sambuc 	u_int8_t	lun;
917*7eb99bdaSLionel Sambuc 	u_int32_t	start_address;
918*7eb99bdaSLionel Sambuc } __packed;
919*7eb99bdaSLionel Sambuc 
920*7eb99bdaSLionel Sambuc /*
921*7eb99bdaSLionel Sambuc  * 22.2 RAID Device Use Definition (UDD)
922*7eb99bdaSLionel Sambuc  */
923*7eb99bdaSLionel Sambuc struct mly_udd {
924*7eb99bdaSLionel Sambuc 	u_int8_t	res1;
925*7eb99bdaSLionel Sambuc 	u_int8_t	state;				/* see 8.1 */
926*7eb99bdaSLionel Sambuc 	u_int16_t	raid_device;
927*7eb99bdaSLionel Sambuc 	u_int32_t	start_address;
928*7eb99bdaSLionel Sambuc } __packed;
929*7eb99bdaSLionel Sambuc 
930*7eb99bdaSLionel Sambuc /*
931*7eb99bdaSLionel Sambuc  * RAID Device Definition (LDD)
932*7eb99bdaSLionel Sambuc  */
933*7eb99bdaSLionel Sambuc struct mly_ldd {
934*7eb99bdaSLionel Sambuc 	u_int8_t	type;				/* see 8.2 */
935*7eb99bdaSLionel Sambuc 	u_int8_t	state;				/* see 8.1 */
936*7eb99bdaSLionel Sambuc 	u_int16_t	raid_device;
937*7eb99bdaSLionel Sambuc 	u_int32_t	device_size;			/* XXX "block or MB" Huh? */
938*7eb99bdaSLionel Sambuc 	u_int8_t	devices_used_count;
939*7eb99bdaSLionel Sambuc 	u_int8_t	stripe_size;			/* see 8.3 */
940*7eb99bdaSLionel Sambuc 	u_int8_t	cache_line_size;		/* see 8.4 */
941*7eb99bdaSLionel Sambuc 	u_int8_t	read_write_control;		/* see 8.5 */
942*7eb99bdaSLionel Sambuc 	u_int32_t	devices_used_size;		/* XXX "block or MB" Huh? */
943*7eb99bdaSLionel Sambuc 	u_int16_t	devices_used[32];		/* XXX actual size of this field unknown! */
944*7eb99bdaSLionel Sambuc } __packed;
945*7eb99bdaSLionel Sambuc 
946*7eb99bdaSLionel Sambuc /*
947*7eb99bdaSLionel Sambuc  * Define a datastructure giving the smallest allocation that will hold
948*7eb99bdaSLionel Sambuc  * a PDD, UDD or LDD for MDACIOCTL_GETDEVCONFINFO.
949*7eb99bdaSLionel Sambuc  */
950*7eb99bdaSLionel Sambuc struct mly_devconf_hdr {
951*7eb99bdaSLionel Sambuc 	u_int8_t	type;				/* see 8.2 */
952*7eb99bdaSLionel Sambuc 	u_int8_t	state;				/* see 8.1 */
953*7eb99bdaSLionel Sambuc 	u_int16_t	raid_device;
954*7eb99bdaSLionel Sambuc };
955*7eb99bdaSLionel Sambuc 
956*7eb99bdaSLionel Sambuc union mly_ioctl_devconfinfo {
957*7eb99bdaSLionel Sambuc 	struct mly_pdd		pdd;
958*7eb99bdaSLionel Sambuc 	struct mly_udd		udd;
959*7eb99bdaSLionel Sambuc 	struct mly_ldd		ldd;
960*7eb99bdaSLionel Sambuc 	struct mly_devconf_hdr	hdr;
961*7eb99bdaSLionel Sambuc };
962*7eb99bdaSLionel Sambuc 
963*7eb99bdaSLionel Sambuc /*
964*7eb99bdaSLionel Sambuc  * 22.3 MDACIOCTL_RENAMERAIDDEV
965*7eb99bdaSLionel Sambuc  *
966*7eb99bdaSLionel Sambuc  * XXX this command is listed as transferring data, but does not define the data.
967*7eb99bdaSLionel Sambuc  */
968*7eb99bdaSLionel Sambuc struct mly_ioctl_param_renameraiddev {
969*7eb99bdaSLionel Sambuc 	u_int8_t	new_raid_device;
970*7eb99bdaSLionel Sambuc } __packed;
971*7eb99bdaSLionel Sambuc 
972*7eb99bdaSLionel Sambuc /*
973*7eb99bdaSLionel Sambuc  * 23.6.2 MDACIOCTL_XLATEPHYSDEVTORAIDDEV
974*7eb99bdaSLionel Sambuc  *
975*7eb99bdaSLionel Sambuc  * XXX documentation suggests this format will change
976*7eb99bdaSLionel Sambuc  */
977*7eb99bdaSLionel Sambuc struct mly_ioctl_param_xlatephysdevtoraiddev {
978*7eb99bdaSLionel Sambuc 	u_int16_t	raid_device;
979*7eb99bdaSLionel Sambuc 	u_int8_t	res1[2];
980*7eb99bdaSLionel Sambuc 	u_int8_t	controller;
981*7eb99bdaSLionel Sambuc 	u_int8_t	channel;
982*7eb99bdaSLionel Sambuc 	u_int8_t	target;
983*7eb99bdaSLionel Sambuc 	u_int8_t	lun;
984*7eb99bdaSLionel Sambuc } __packed;
985*7eb99bdaSLionel Sambuc 
986*7eb99bdaSLionel Sambuc /*
987*7eb99bdaSLionel Sambuc  * 23.7 MDACIOCTL_GETGROUPCONFINFO
988*7eb99bdaSLionel Sambuc  */
989*7eb99bdaSLionel Sambuc struct mly_ioctl_param_getgroupconfinfo {
990*7eb99bdaSLionel Sambuc 	u_int16_t			group;
991*7eb99bdaSLionel Sambuc 	u_int8_t			res1[8];
992*7eb99bdaSLionel Sambuc 	union mly_cmd_transfer	transfer;
993*7eb99bdaSLionel Sambuc } __packed;
994*7eb99bdaSLionel Sambuc 
995*7eb99bdaSLionel Sambuc /*
996*7eb99bdaSLionel Sambuc  * 23.9.2 MDACIOCTL_GETFREESPACELIST: Data Format
997*7eb99bdaSLionel Sambuc  *
998*7eb99bdaSLionel Sambuc  * The controller will populate as much of this structure as is provided,
999*7eb99bdaSLionel Sambuc  * or as is required to fully list the free space available.
1000*7eb99bdaSLionel Sambuc  */
1001*7eb99bdaSLionel Sambuc struct mly_ioctl_getfreespacelist_entry {
1002*7eb99bdaSLionel Sambuc 	u_int16_t	raid_device;
1003*7eb99bdaSLionel Sambuc 	u_int8_t	res1[6];
1004*7eb99bdaSLionel Sambuc 	u_int32_t	address;		/* XXX "blocks or MB" Huh? */
1005*7eb99bdaSLionel Sambuc 	u_int32_t	size;			/* XXX "blocks or MB" Huh? */
1006*7eb99bdaSLionel Sambuc } __packed;
1007*7eb99bdaSLionel Sambuc 
1008*7eb99bdaSLionel Sambuc struct mly_ioctl_getfrespacelist {
1009*7eb99bdaSLionel Sambuc 	u_int16_t	returned_entries;
1010*7eb99bdaSLionel Sambuc 	u_int16_t	total_entries;
1011*7eb99bdaSLionel Sambuc 	u_int8_t	res1[12];
1012*7eb99bdaSLionel Sambuc 	struct mly_ioctl_getfreespacelist_entry space[];	/* expand to suit */
1013*7eb99bdaSLionel Sambuc } __packed;
1014*7eb99bdaSLionel Sambuc 
1015*7eb99bdaSLionel Sambuc /*
1016*7eb99bdaSLionel Sambuc  * 27.1 MDACIOCTL_GETSUBSYSTEMDATA
1017*7eb99bdaSLionel Sambuc  * 27.2 MDACIOCTL_SETSUBSYSTEMDATA
1018*7eb99bdaSLionel Sambuc  *
1019*7eb99bdaSLionel Sambuc  * PCI controller only supports a limited subset of the possible operations.
1020*7eb99bdaSLionel Sambuc  *
1021*7eb99bdaSLionel Sambuc  * XXX where does the status end up? (the command transfers no data)
1022*7eb99bdaSLionel Sambuc  */
1023*7eb99bdaSLionel Sambuc struct mly_ioctl_param_subsystemdata {
1024*7eb99bdaSLionel Sambuc 	u_int8_t	operation:4;
1025*7eb99bdaSLionel Sambuc #define	MLY_BBU_GETSTATUS	0x00
1026*7eb99bdaSLionel Sambuc #define	MLY_BBU_SET_THRESHOLD	0x00	/* minutes in param[0,1] */
1027*7eb99bdaSLionel Sambuc 	u_int8_t	subsystem:4;
1028*7eb99bdaSLionel Sambuc #define	MLY_SUBSYSTEM_BBU	0x01
1029*7eb99bdaSLionel Sambuc 	u_int	parameter[3];		/* only for SETSUBSYSTEMDATA */
1030*7eb99bdaSLionel Sambuc } __packed;
1031*7eb99bdaSLionel Sambuc 
1032*7eb99bdaSLionel Sambuc struct mly_ioctl_getsubsystemdata_bbustatus {
1033*7eb99bdaSLionel Sambuc 	u_int16_t	current_power;
1034*7eb99bdaSLionel Sambuc 	u_int16_t	maximum_power;
1035*7eb99bdaSLionel Sambuc 	u_int16_t	power_threshold;
1036*7eb99bdaSLionel Sambuc 	u_int8_t	charge_level;
1037*7eb99bdaSLionel Sambuc 	u_int8_t	hardware_version;
1038*7eb99bdaSLionel Sambuc 	u_int8_t	battery_type;
1039*7eb99bdaSLionel Sambuc #define	MLY_BBU_TYPE_UNKNOWN	0x00
1040*7eb99bdaSLionel Sambuc #define	MLY_BBU_TYPE_NICAD	0x01
1041*7eb99bdaSLionel Sambuc #define	MLY_BBU_TYPE_MISSING	0xfe
1042*7eb99bdaSLionel Sambuc 	u_int8_t	res1;
1043*7eb99bdaSLionel Sambuc 	u_int8_t	operation_status;
1044*7eb99bdaSLionel Sambuc #define	MLY_BBU_STATUS_NO_SYNC		0x01
1045*7eb99bdaSLionel Sambuc #define	MLY_BBU_STATUS_OUT_OF_SYNC	0x02
1046*7eb99bdaSLionel Sambuc #define	MLY_BBU_STATUS_FIRST_WARNING	0x04
1047*7eb99bdaSLionel Sambuc #define	MLY_BBU_STATUS_SECOND_WARNING	0x08
1048*7eb99bdaSLionel Sambuc #define	MLY_BBU_STATUS_RECONDITIONING	0x10
1049*7eb99bdaSLionel Sambuc #define	MLY_BBU_STATUS_DISCHARGING	0x20
1050*7eb99bdaSLionel Sambuc #define	MLY_BBU_STATUS_FASTCHARGING	0x40
1051*7eb99bdaSLionel Sambuc 	u_int8_t	res2;
1052*7eb99bdaSLionel Sambuc } __packed;
1053*7eb99bdaSLionel Sambuc 
1054*7eb99bdaSLionel Sambuc /*
1055*7eb99bdaSLionel Sambuc  * 28.9  MDACIOCTL_RESETDEVICE
1056*7eb99bdaSLionel Sambuc  * 28.10 MDACIOCTL_FLUSHDEVICEDATA
1057*7eb99bdaSLionel Sambuc  * 28.11 MDACIOCTL_PAUSEDEVICE
1058*7eb99bdaSLionel Sambuc  * 28.12 MDACIOCTL_UNPAUSEDEVICE
1059*7eb99bdaSLionel Sambuc  */
1060*7eb99bdaSLionel Sambuc struct mly_ioctl_param_deviceoperation {
1061*7eb99bdaSLionel Sambuc 	u_int8_t	operation_device;		/* see 14.3 */
1062*7eb99bdaSLionel Sambuc } __packed;
1063*7eb99bdaSLionel Sambuc 
1064*7eb99bdaSLionel Sambuc /*
1065*7eb99bdaSLionel Sambuc  * 31.1 Event Data Format
1066*7eb99bdaSLionel Sambuc  */
1067*7eb99bdaSLionel Sambuc struct mly_event {
1068*7eb99bdaSLionel Sambuc 	u_int32_t	sequence_number;
1069*7eb99bdaSLionel Sambuc 	u_int32_t	timestamp;
1070*7eb99bdaSLionel Sambuc 	u_int32_t	code;
1071*7eb99bdaSLionel Sambuc 	u_int8_t	controller;
1072*7eb99bdaSLionel Sambuc 	u_int8_t	channel;
1073*7eb99bdaSLionel Sambuc 	u_int8_t	target;				/* also enclosure */
1074*7eb99bdaSLionel Sambuc 	u_int8_t	lun;				/* also enclosure unit */
1075*7eb99bdaSLionel Sambuc 	u_int8_t   	res1[4];
1076*7eb99bdaSLionel Sambuc 	u_int32_t	param;
1077*7eb99bdaSLionel Sambuc 	u_int8_t	sense[40];
1078*7eb99bdaSLionel Sambuc } __packed;
1079*7eb99bdaSLionel Sambuc 
1080*7eb99bdaSLionel Sambuc /*
1081*7eb99bdaSLionel Sambuc  * 31.2 MDACIOCTL_GETEVENT
1082*7eb99bdaSLionel Sambuc  */
1083*7eb99bdaSLionel Sambuc struct mly_ioctl_param_getevent {
1084*7eb99bdaSLionel Sambuc 	u_int16_t		sequence_number_low;
1085*7eb99bdaSLionel Sambuc 	u_int8_t		res1[8];
1086*7eb99bdaSLionel Sambuc 	union mly_cmd_transfer	transfer;
1087*7eb99bdaSLionel Sambuc } __packed;
1088*7eb99bdaSLionel Sambuc 
1089*7eb99bdaSLionel Sambuc union mly_ioctl_param {
1090*7eb99bdaSLionel Sambuc 	struct mly_ioctl_param_data			data;
1091*7eb99bdaSLionel Sambuc 	struct mly_ioctl_param_setmemorymailbox		setmemorymailbox;
1092*7eb99bdaSLionel Sambuc 	struct mly_ioctl_param_setraiddevstate		setraiddevstate;
1093*7eb99bdaSLionel Sambuc 	struct mly_ioctl_param_renameraiddev		renameraiddev;
1094*7eb99bdaSLionel Sambuc 	struct mly_ioctl_param_xlatephysdevtoraiddev	xlatephysdevtoraiddev;
1095*7eb99bdaSLionel Sambuc 	struct mly_ioctl_param_getgroupconfinfo		getgroupconfinfo;
1096*7eb99bdaSLionel Sambuc 	struct mly_ioctl_param_subsystemdata		subsystemdata;
1097*7eb99bdaSLionel Sambuc 	struct mly_ioctl_param_deviceoperation		deviceoperation;
1098*7eb99bdaSLionel Sambuc 	struct mly_ioctl_param_getevent			getevent;
1099*7eb99bdaSLionel Sambuc };
1100*7eb99bdaSLionel Sambuc 
1101*7eb99bdaSLionel Sambuc /*
1102*7eb99bdaSLionel Sambuc  * 19 SCSI Command Format
1103*7eb99bdaSLionel Sambuc  */
1104*7eb99bdaSLionel Sambuc #define	MLY_PHYADDR(c, b, t, l)	\
1105*7eb99bdaSLionel Sambuc 	((l) | ((t) << 8) | ((b) << 16) | ((c) << 19))
1106*7eb99bdaSLionel Sambuc #define	MLY_LOGADDR(c, u)	\
1107*7eb99bdaSLionel Sambuc 	((u) | ((c) << 19))
1108*7eb99bdaSLionel Sambuc 
1109*7eb99bdaSLionel Sambuc #define	MLY_LOGADDR_DEV(a)		(a & 0xffff)
1110*7eb99bdaSLionel Sambuc #define	MLY_LOGADDR_CTLR(a)		(a >> 19)
1111*7eb99bdaSLionel Sambuc 
1112*7eb99bdaSLionel Sambuc #define	MLY_PHYADDR_LUN(a)		(a & 0xff)
1113*7eb99bdaSLionel Sambuc #define	MLY_PHYADDR_TARGET(a)		((a >> 8) & 0xff)
1114*7eb99bdaSLionel Sambuc #define	MLY_PHYADDR_CHANNEL(a)		((a >> 16) & 0x07)
1115*7eb99bdaSLionel Sambuc #define	MLY_PHYADDR_CTLR(a)		((a >> 19) & 0x1f)
1116*7eb99bdaSLionel Sambuc 
1117*7eb99bdaSLionel Sambuc /*
1118*7eb99bdaSLionel Sambuc  * struct mly_cmd_address_physical {
1119*7eb99bdaSLionel Sambuc  *	u_int8_t			lun;
1120*7eb99bdaSLionel Sambuc  *	u_int8_t			target;
1121*7eb99bdaSLionel Sambuc  *	u_int8_t			channel:3;
1122*7eb99bdaSLionel Sambuc  *	u_int8_t			controller:5;
1123*7eb99bdaSLionel Sambuc  * } __packed;
1124*7eb99bdaSLionel Sambuc  *
1125*7eb99bdaSLionel Sambuc  * struct mly_cmd_address_logical {
1126*7eb99bdaSLionel Sambuc  *	u_int16_t			logdev;
1127*7eb99bdaSLionel Sambuc  *	u_int8_t			res1:3;
1128*7eb99bdaSLionel Sambuc  *	u_int8_t			controller:5;
1129*7eb99bdaSLionel Sambuc  * } __packed;
1130*7eb99bdaSLionel Sambuc  */
1131*7eb99bdaSLionel Sambuc 
1132*7eb99bdaSLionel Sambuc struct mly_cmd_generic {
1133*7eb99bdaSLionel Sambuc 	u_int16_t			command_id;
1134*7eb99bdaSLionel Sambuc 	u_int8_t			opcode;
1135*7eb99bdaSLionel Sambuc 	u_int8_t			command_control;
1136*7eb99bdaSLionel Sambuc 	u_int32_t			data_size;
1137*7eb99bdaSLionel Sambuc 	u_int64_t			sense_buffer_address;
1138*7eb99bdaSLionel Sambuc 	u_int8_t			addr[3];
1139*7eb99bdaSLionel Sambuc 	u_int8_t			timeout;
1140*7eb99bdaSLionel Sambuc 	u_int8_t			maximum_sense_size;
1141*7eb99bdaSLionel Sambuc 	u_int8_t			res1[11];
1142*7eb99bdaSLionel Sambuc 	union mly_cmd_transfer	transfer;
1143*7eb99bdaSLionel Sambuc } __packed;
1144*7eb99bdaSLionel Sambuc 
1145*7eb99bdaSLionel Sambuc 
1146*7eb99bdaSLionel Sambuc /*
1147*7eb99bdaSLionel Sambuc  * 19.1 MDACMD_SCSI & MDACMD_SCSIPT
1148*7eb99bdaSLionel Sambuc  */
1149*7eb99bdaSLionel Sambuc #define	MLY_CMD_SCSI_SMALL_CDB	10
1150*7eb99bdaSLionel Sambuc struct mly_cmd_scsi_small {
1151*7eb99bdaSLionel Sambuc 	u_int16_t			command_id;
1152*7eb99bdaSLionel Sambuc 	u_int8_t			opcode;
1153*7eb99bdaSLionel Sambuc 	u_int8_t			command_control;
1154*7eb99bdaSLionel Sambuc 	u_int32_t			data_size;
1155*7eb99bdaSLionel Sambuc 	u_int64_t			sense_buffer_address;
1156*7eb99bdaSLionel Sambuc 	u_int8_t			addr[3];
1157*7eb99bdaSLionel Sambuc 	u_int8_t			timeout;
1158*7eb99bdaSLionel Sambuc 	u_int8_t			maximum_sense_size;
1159*7eb99bdaSLionel Sambuc 	u_int8_t			cdb_length;
1160*7eb99bdaSLionel Sambuc 	u_int8_t			cdb[MLY_CMD_SCSI_SMALL_CDB];
1161*7eb99bdaSLionel Sambuc 	union mly_cmd_transfer	transfer;
1162*7eb99bdaSLionel Sambuc } __packed;
1163*7eb99bdaSLionel Sambuc 
1164*7eb99bdaSLionel Sambuc /*
1165*7eb99bdaSLionel Sambuc  * 19.2 MDACMD_SCSILC & MDACMD_SCSILCPT
1166*7eb99bdaSLionel Sambuc  */
1167*7eb99bdaSLionel Sambuc struct mly_cmd_scsi_large {
1168*7eb99bdaSLionel Sambuc 	u_int16_t			command_id;
1169*7eb99bdaSLionel Sambuc 	u_int8_t			opcode;
1170*7eb99bdaSLionel Sambuc 	u_int8_t			command_control;
1171*7eb99bdaSLionel Sambuc 	u_int32_t			data_size;
1172*7eb99bdaSLionel Sambuc 	u_int64_t			sense_buffer_address;
1173*7eb99bdaSLionel Sambuc 	u_int8_t			addr[3];
1174*7eb99bdaSLionel Sambuc 	u_int8_t			timeout;
1175*7eb99bdaSLionel Sambuc 	u_int8_t			maximum_sense_size;
1176*7eb99bdaSLionel Sambuc 	u_int8_t			cdb_length;
1177*7eb99bdaSLionel Sambuc 	u_int16_t			res1;
1178*7eb99bdaSLionel Sambuc 	u_int64_t			cdb_physaddr;
1179*7eb99bdaSLionel Sambuc 	union mly_cmd_transfer	transfer;
1180*7eb99bdaSLionel Sambuc } __packed;
1181*7eb99bdaSLionel Sambuc 
1182*7eb99bdaSLionel Sambuc /*
1183*7eb99bdaSLionel Sambuc  * 20.1 IOCTL Command Format: Internal Bus
1184*7eb99bdaSLionel Sambuc  */
1185*7eb99bdaSLionel Sambuc struct mly_cmd_ioctl {
1186*7eb99bdaSLionel Sambuc 	u_int16_t			command_id;
1187*7eb99bdaSLionel Sambuc 	u_int8_t			opcode;
1188*7eb99bdaSLionel Sambuc 	u_int8_t			command_control;
1189*7eb99bdaSLionel Sambuc 	u_int32_t			data_size;
1190*7eb99bdaSLionel Sambuc 	u_int64_t			sense_buffer_address;
1191*7eb99bdaSLionel Sambuc 	u_int8_t			addr[3];
1192*7eb99bdaSLionel Sambuc 	u_int8_t			timeout;
1193*7eb99bdaSLionel Sambuc 	u_int8_t			maximum_sense_size;
1194*7eb99bdaSLionel Sambuc 	u_int8_t			sub_ioctl;
1195*7eb99bdaSLionel Sambuc 	union mly_ioctl_param		param;
1196*7eb99bdaSLionel Sambuc } __packed;
1197*7eb99bdaSLionel Sambuc 
1198*7eb99bdaSLionel Sambuc /*
1199*7eb99bdaSLionel Sambuc  * PG6: 8.2.2
1200*7eb99bdaSLionel Sambuc  */
1201*7eb99bdaSLionel Sambuc struct mly_cmd_mmbox {
1202*7eb99bdaSLionel Sambuc 	u_int32_t			flag;
1203*7eb99bdaSLionel Sambuc 	u_int8_t			data[60];
1204*7eb99bdaSLionel Sambuc } __packed;
1205*7eb99bdaSLionel Sambuc 
1206*7eb99bdaSLionel Sambuc union mly_cmd_packet {
1207*7eb99bdaSLionel Sambuc 	struct mly_cmd_generic		generic;
1208*7eb99bdaSLionel Sambuc 	struct mly_cmd_scsi_small	scsi_small;
1209*7eb99bdaSLionel Sambuc 	struct mly_cmd_scsi_large	scsi_large;
1210*7eb99bdaSLionel Sambuc 	struct mly_cmd_ioctl		ioctl;
1211*7eb99bdaSLionel Sambuc 	struct mly_cmd_mmbox		mmbox;
1212*7eb99bdaSLionel Sambuc };
1213*7eb99bdaSLionel Sambuc 
1214*7eb99bdaSLionel Sambuc /*
1215*7eb99bdaSLionel Sambuc  * PG6: 5.3
1216*7eb99bdaSLionel Sambuc  */
1217*7eb99bdaSLionel Sambuc #define	MLY_I960RX_COMMAND_MAILBOX	0x10
1218*7eb99bdaSLionel Sambuc #define	MLY_I960RX_STATUS_MAILBOX	0x18
1219*7eb99bdaSLionel Sambuc #define	MLY_I960RX_IDBR			0x20
1220*7eb99bdaSLionel Sambuc #define	MLY_I960RX_ODBR			0x2c
1221*7eb99bdaSLionel Sambuc #define	MLY_I960RX_ERROR_STATUS		0x2e
1222*7eb99bdaSLionel Sambuc #define	MLY_I960RX_INTERRUPT_STATUS	0x30
1223*7eb99bdaSLionel Sambuc #define	MLY_I960RX_INTERRUPT_MASK	0x34
1224*7eb99bdaSLionel Sambuc 
1225*7eb99bdaSLionel Sambuc #define	MLY_STRONGARM_COMMAND_MAILBOX	0x50
1226*7eb99bdaSLionel Sambuc #define	MLY_STRONGARM_STATUS_MAILBOX	0x58
1227*7eb99bdaSLionel Sambuc #define	MLY_STRONGARM_IDBR		0x60
1228*7eb99bdaSLionel Sambuc #define	MLY_STRONGARM_ODBR		0x61
1229*7eb99bdaSLionel Sambuc #define	MLY_STRONGARM_ERROR_STATUS	0x63
1230*7eb99bdaSLionel Sambuc #define	MLY_STRONGARM_INTERRUPT_STATUS	0x30
1231*7eb99bdaSLionel Sambuc #define	MLY_STRONGARM_INTERRUPT_MASK	0x34
1232*7eb99bdaSLionel Sambuc 
1233*7eb99bdaSLionel Sambuc /*
1234*7eb99bdaSLionel Sambuc  * PG6: 5.4.3 Doorbell 0
1235*7eb99bdaSLionel Sambuc  */
1236*7eb99bdaSLionel Sambuc #define	MLY_HM_CMDSENT			(1<<0)
1237*7eb99bdaSLionel Sambuc #define	MLY_HM_STSACK			(1<<1)
1238*7eb99bdaSLionel Sambuc #define	MLY_SOFT_RST			(1<<3)
1239*7eb99bdaSLionel Sambuc #define	MLY_AM_CMDSENT			(1<<4)
1240*7eb99bdaSLionel Sambuc 
1241*7eb99bdaSLionel Sambuc /*
1242*7eb99bdaSLionel Sambuc  * PG6: 5.4.4 Doorbell 1
1243*7eb99bdaSLionel Sambuc  *
1244*7eb99bdaSLionel Sambuc  * Note that the documentation claims that these bits are set when the
1245*7eb99bdaSLionel Sambuc  * status queue(s) are empty, wheras the Linux driver and experience
1246*7eb99bdaSLionel Sambuc  * suggest they are set when there is status available.
1247*7eb99bdaSLionel Sambuc  */
1248*7eb99bdaSLionel Sambuc #define	MLY_HM_STSREADY			(1<<0)
1249*7eb99bdaSLionel Sambuc #define	MLY_AM_STSREADY			(1<<1)
1250*7eb99bdaSLionel Sambuc 
1251*7eb99bdaSLionel Sambuc /*
1252*7eb99bdaSLionel Sambuc  * PG6: 5.4.6 Doorbell 3
1253*7eb99bdaSLionel Sambuc  */
1254*7eb99bdaSLionel Sambuc #define	MLY_MSG_EMPTY			(1<<3)
1255*7eb99bdaSLionel Sambuc #define	MLY_MSG_SPINUP			0x08
1256*7eb99bdaSLionel Sambuc #define	MLY_MSG_RACE_RECOVERY_FAIL	0x60
1257*7eb99bdaSLionel Sambuc #define	MLY_MSG_RACE_IN_PROGRESS	0x70
1258*7eb99bdaSLionel Sambuc #define	MLY_MSG_RACE_ON_CRITICAL	0xb0
1259*7eb99bdaSLionel Sambuc #define	MLY_MSG_PARITY_ERROR		0xf0
1260*7eb99bdaSLionel Sambuc 
1261*7eb99bdaSLionel Sambuc /*
1262*7eb99bdaSLionel Sambuc  * PG6: 5.4.8 Outbound Interrupt Mask
1263*7eb99bdaSLionel Sambuc  */
1264*7eb99bdaSLionel Sambuc #define	MLY_INTERRUPT_MASK_DISABLE	0xff
1265*7eb99bdaSLionel Sambuc #define	MLY_INTERRUPT_MASK_ENABLE	(0xff & ~(1<<2))
1266*7eb99bdaSLionel Sambuc 
1267*7eb99bdaSLionel Sambuc /*
1268*7eb99bdaSLionel Sambuc  * PG6: 8.2 Advanced Mailbox Scheme
1269*7eb99bdaSLionel Sambuc  *
1270*7eb99bdaSLionel Sambuc  * Note that this must be allocated on a 4k boundary, and all internal
1271*7eb99bdaSLionel Sambuc  * fields must also reside on a 4k boundary.
1272*7eb99bdaSLionel Sambuc  * We could dynamically size this structure, but the extra effort
1273*7eb99bdaSLionel Sambuc  * is probably unjustified.  Note that these buffers do not need to be
1274*7eb99bdaSLionel Sambuc  * adjacent - we just group them to simplify allocation of the bus-visible
1275*7eb99bdaSLionel Sambuc  * buffer.
1276*7eb99bdaSLionel Sambuc  *
1277*7eb99bdaSLionel Sambuc  * XXX Note that for some reason, if MLY_MMBOX_COMMANDS is > 64, the controller
1278*7eb99bdaSLionel Sambuc  * fails to respond to the command at (MLY_MMBOX_COMMANDS - 64).  It's not
1279*7eb99bdaSLionel Sambuc  * wrapping to 0 at this point (determined by experimentation).  This is not
1280*7eb99bdaSLionel Sambuc  * consistent with the Linux driver's implementation.
1281*7eb99bdaSLionel Sambuc  * Whilst it's handy to have lots of room for status returns in case we end up
1282*7eb99bdaSLionel Sambuc  * being slow getting back to completed commands, it seems unlikely that we
1283*7eb99bdaSLionel Sambuc  * would get 64 commands ahead of the controller on the submissions side, so
1284*7eb99bdaSLionel Sambuc  * the current workaround is to simply limit the command ring to 64 entries.
1285*7eb99bdaSLionel Sambuc  */
1286*7eb99bdaSLionel Sambuc union mly_status_packet {
1287*7eb99bdaSLionel Sambuc 	 struct mly_status		status;
1288*7eb99bdaSLionel Sambuc 	 struct {
1289*7eb99bdaSLionel Sambuc 		 u_int32_t		flag;
1290*7eb99bdaSLionel Sambuc 		 u_int8_t		data[4];
1291*7eb99bdaSLionel Sambuc 	 } __packed mmbox;
1292*7eb99bdaSLionel Sambuc };
1293*7eb99bdaSLionel Sambuc union mly_health_region {
1294*7eb99bdaSLionel Sambuc 	struct mly_health_status	status;
1295*7eb99bdaSLionel Sambuc 	u_int8_t			pad[1024];
1296*7eb99bdaSLionel Sambuc };
1297*7eb99bdaSLionel Sambuc 
1298*7eb99bdaSLionel Sambuc #define	MLY_MMBOX_COMMANDS		64
1299*7eb99bdaSLionel Sambuc #define	MLY_MMBOX_STATUS		512
1300*7eb99bdaSLionel Sambuc struct mly_mmbox {
1301*7eb99bdaSLionel Sambuc 	union mly_cmd_packet	mmm_command[MLY_MMBOX_COMMANDS];
1302*7eb99bdaSLionel Sambuc 	union mly_status_packet	mmm_status[MLY_MMBOX_STATUS];
1303*7eb99bdaSLionel Sambuc 	union mly_health_region	mmm_health;
1304*7eb99bdaSLionel Sambuc } __packed;
1305*7eb99bdaSLionel Sambuc 
1306*7eb99bdaSLionel Sambuc #endif	/* !defined _PCI_MLYREG_H_ */
1307