xref: /minix3/sys/dev/pci/amrreg.h (revision 7eb99bda90fc3b15ed07bfd8809650d0818ad5f7)
1*7eb99bdaSLionel Sambuc /*	$NetBSD: amrreg.h,v 1.5 2008/09/08 23:36:54 gmcgarry Exp $	*/
2*7eb99bdaSLionel Sambuc 
3*7eb99bdaSLionel Sambuc /*-
4*7eb99bdaSLionel Sambuc  * Copyright (c) 2002, 2003 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.
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) 1999,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: amrreg.h,v 1.2 2000/08/30 07:52:40 msmith Exp
59*7eb99bdaSLionel Sambuc  */
60*7eb99bdaSLionel Sambuc 
61*7eb99bdaSLionel Sambuc #ifndef	_PCI_AMRREG_H_
62*7eb99bdaSLionel Sambuc #define	_PCI_AMRREG_H_
63*7eb99bdaSLionel Sambuc 
64*7eb99bdaSLionel Sambuc #ifdef AMR_CRASH_ME
65*7eb99bdaSLionel Sambuc #define	AMR_MAX_CMDS		255		/* ident = 0 not allowed */
66*7eb99bdaSLionel Sambuc #else
67*7eb99bdaSLionel Sambuc #define	AMR_MAX_CMDS		120
68*7eb99bdaSLionel Sambuc #endif
69*7eb99bdaSLionel Sambuc #define	AMR_MAXLD      		40
70*7eb99bdaSLionel Sambuc 
71*7eb99bdaSLionel Sambuc #define	AMR_MAX_CMDS_PU		63
72*7eb99bdaSLionel Sambuc 
73*7eb99bdaSLionel Sambuc #define	AMR_MAX_SEGS		26
74*7eb99bdaSLionel Sambuc #define	AMR_MAX_CHANNEL		3
75*7eb99bdaSLionel Sambuc #define	AMR_MAX_TARGET		15
76*7eb99bdaSLionel Sambuc #define	AMR_MAX_LUN		7
77*7eb99bdaSLionel Sambuc 
78*7eb99bdaSLionel Sambuc #define	AMR_MAX_CDB_LEN		0x0a
79*7eb99bdaSLionel Sambuc #define	AMR_MAX_REQ_SENSE_LEN	0x20
80*7eb99bdaSLionel Sambuc 
81*7eb99bdaSLionel Sambuc #define	AMR_SECTOR_SIZE		512
82*7eb99bdaSLionel Sambuc 
83*7eb99bdaSLionel Sambuc /* Mailbox commands.*/
84*7eb99bdaSLionel Sambuc #define	AMR_CMD_LREAD		0x01
85*7eb99bdaSLionel Sambuc #define	AMR_CMD_LWRITE		0x02
86*7eb99bdaSLionel Sambuc #define	AMR_CMD_PASS		0x03
87*7eb99bdaSLionel Sambuc #define	AMR_CMD_EXT_ENQUIRY	0x04
88*7eb99bdaSLionel Sambuc #define	AMR_CMD_ENQUIRY		0x05
89*7eb99bdaSLionel Sambuc #define	AMR_CMD_FLUSH		0x0a
90*7eb99bdaSLionel Sambuc #define	AMR_CMD_EXT_ENQUIRY2	0x0c
91*7eb99bdaSLionel Sambuc #define	AMR_CMD_GET_MACHINEID	0x36
92*7eb99bdaSLionel Sambuc #define	AMR_CMD_GET_INITIATOR	0x7d	/* returns one byte */
93*7eb99bdaSLionel Sambuc #define	AMR_CMD_CONFIG		0xa1
94*7eb99bdaSLionel Sambuc #define	AMR_CONFIG_PRODUCT_INFO			0x0e
95*7eb99bdaSLionel Sambuc #define	AMR_CONFIG_ENQ3				0x0f
96*7eb99bdaSLionel Sambuc #define	AMR_CONFIG_ENQ3_SOLICITED_NOTIFY	0x01
97*7eb99bdaSLionel Sambuc #define	AMR_CONFIG_ENQ3_SOLICITED_FULL		0x02
98*7eb99bdaSLionel Sambuc #define	AMR_CONFIG_ENQ3_UNSOLICITED		0x03
99*7eb99bdaSLionel Sambuc 
100*7eb99bdaSLionel Sambuc /* Command completion status. */
101*7eb99bdaSLionel Sambuc #define	AMR_STATUS_SUCCESS	0x00
102*7eb99bdaSLionel Sambuc #define	AMR_STATUS_ABORTED	0x02
103*7eb99bdaSLionel Sambuc #define	AMR_STATUS_FAILED	0x80
104*7eb99bdaSLionel Sambuc 
105*7eb99bdaSLionel Sambuc /* Physical/logical drive states. */
106*7eb99bdaSLionel Sambuc #define	AMR_DRV_CURSTATE(x)	((x) & 0x0f)
107*7eb99bdaSLionel Sambuc #define	AMR_DRV_PREVSTATE(x)	(((x) >> 4) & 0x0f)
108*7eb99bdaSLionel Sambuc #define	AMR_DRV_OFFLINE		0x00
109*7eb99bdaSLionel Sambuc #define	AMR_DRV_DEGRADED	0x01
110*7eb99bdaSLionel Sambuc #define	AMR_DRV_OPTIMAL		0x02
111*7eb99bdaSLionel Sambuc #define	AMR_DRV_ONLINE		0x03
112*7eb99bdaSLionel Sambuc #define	AMR_DRV_FAILED		0x04
113*7eb99bdaSLionel Sambuc #define	AMR_DRV_REBUILD		0x05
114*7eb99bdaSLionel Sambuc #define	AMR_DRV_HOTSPARE	0x06
115*7eb99bdaSLionel Sambuc 
116*7eb99bdaSLionel Sambuc /* Logical drive properties. */
117*7eb99bdaSLionel Sambuc #define	AMR_DRV_RAID_MASK	0x0f	/* RAID level 0, 1, 3, 5, etc. */
118*7eb99bdaSLionel Sambuc #define	AMR_DRV_WRITEBACK	0x10	/* write-back enabled */
119*7eb99bdaSLionel Sambuc #define	AMR_DRV_READHEAD	0x20	/* readhead policy enabled */
120*7eb99bdaSLionel Sambuc #define	AMR_DRV_ADAPTIVE	0x40	/* adaptive I/O policy enabled */
121*7eb99bdaSLionel Sambuc 
122*7eb99bdaSLionel Sambuc /* Battery status. */
123*7eb99bdaSLionel Sambuc #define	AMR_BATT_MODULE_MISSING		0x01
124*7eb99bdaSLionel Sambuc #define	AMR_BATT_LOW_VOLTAGE		0x02
125*7eb99bdaSLionel Sambuc #define	AMR_BATT_TEMP_HIGH		0x04
126*7eb99bdaSLionel Sambuc #define	AMR_BATT_PACK_MISSING		0x08
127*7eb99bdaSLionel Sambuc #define	AMR_BATT_CHARGE_MASK		0x30
128*7eb99bdaSLionel Sambuc #define	AMR_BATT_CHARGE_DONE		0x00
129*7eb99bdaSLionel Sambuc #define	AMR_BATT_CHARGE_INPROG		0x10
130*7eb99bdaSLionel Sambuc #define	AMR_BATT_CHARGE_FAIL		0x20
131*7eb99bdaSLionel Sambuc #define	AMR_BATT_CYCLES_EXCEEDED	0x40
132*7eb99bdaSLionel Sambuc 
133*7eb99bdaSLionel Sambuc /*
134*7eb99bdaSLionel Sambuc  * 8LD firmware interface.
135*7eb99bdaSLionel Sambuc  */
136*7eb99bdaSLionel Sambuc 
137*7eb99bdaSLionel Sambuc /* Array constraints. */
138*7eb99bdaSLionel Sambuc #define	AMR_8LD_MAXDRIVES	8
139*7eb99bdaSLionel Sambuc #define	AMR_8LD_MAXCHAN		5
140*7eb99bdaSLionel Sambuc #define	AMR_8LD_MAXTARG		15
141*7eb99bdaSLionel Sambuc #define	AMR_8LD_MAXPHYSDRIVES	(AMR_8LD_MAXCHAN * AMR_8LD_MAXTARG)
142*7eb99bdaSLionel Sambuc 
143*7eb99bdaSLionel Sambuc /* Adapter information. */
144*7eb99bdaSLionel Sambuc struct amr_adapter_info {
145*7eb99bdaSLionel Sambuc 	u_int8_t	aa_maxio;
146*7eb99bdaSLionel Sambuc 	u_int8_t	aa_rebuild_rate;
147*7eb99bdaSLionel Sambuc 	u_int8_t	aa_maxtargchan;
148*7eb99bdaSLionel Sambuc 	u_int8_t	aa_channels;
149*7eb99bdaSLionel Sambuc 	u_int8_t	aa_firmware[4];
150*7eb99bdaSLionel Sambuc 	u_int16_t	aa_flashage;
151*7eb99bdaSLionel Sambuc 	u_int8_t	aa_chipsetvalue;
152*7eb99bdaSLionel Sambuc 	u_int8_t	aa_memorysize;
153*7eb99bdaSLionel Sambuc 	u_int8_t	aa_cacheflush;
154*7eb99bdaSLionel Sambuc 	u_int8_t	aa_bios[4];
155*7eb99bdaSLionel Sambuc 	u_int8_t	aa_boardtype;
156*7eb99bdaSLionel Sambuc 	u_int8_t	aa_scsisensealert;
157*7eb99bdaSLionel Sambuc 	u_int8_t	aa_writeconfigcount;
158*7eb99bdaSLionel Sambuc 	u_int8_t	aa_driveinsertioncount;
159*7eb99bdaSLionel Sambuc 	u_int8_t	aa_inserteddrive;
160*7eb99bdaSLionel Sambuc 	u_int8_t	aa_batterystatus;
161*7eb99bdaSLionel Sambuc 	u_int8_t   	aa_res1;
162*7eb99bdaSLionel Sambuc } __packed;
163*7eb99bdaSLionel Sambuc 
164*7eb99bdaSLionel Sambuc /* Logical drive information. */
165*7eb99bdaSLionel Sambuc struct amr_logdrive_info {
166*7eb99bdaSLionel Sambuc 	u_int8_t	al_numdrives;
167*7eb99bdaSLionel Sambuc 	u_int8_t	al_res1[3];
168*7eb99bdaSLionel Sambuc 	u_int32_t	al_size[AMR_8LD_MAXDRIVES];
169*7eb99bdaSLionel Sambuc 	u_int8_t	al_properties[AMR_8LD_MAXDRIVES];
170*7eb99bdaSLionel Sambuc 	u_int8_t	al_state[AMR_8LD_MAXDRIVES];
171*7eb99bdaSLionel Sambuc } __packed;
172*7eb99bdaSLionel Sambuc 
173*7eb99bdaSLionel Sambuc /* Physical drive information. */
174*7eb99bdaSLionel Sambuc struct amr_physdrive_info {
175*7eb99bdaSLionel Sambuc 	/* Low nybble is current state, high nybble is previous state. */
176*7eb99bdaSLionel Sambuc 	u_int8_t	ap_state[AMR_8LD_MAXPHYSDRIVES];
177*7eb99bdaSLionel Sambuc 	u_int8_t	ap_predictivefailure;
178*7eb99bdaSLionel Sambuc } __packed;
179*7eb99bdaSLionel Sambuc 
180*7eb99bdaSLionel Sambuc /*
181*7eb99bdaSLionel Sambuc  * Enquiry response structure for AMR_CMD_ENQUIRY (e), AMR_CMD_EXT_ENQUIRY (x)
182*7eb99bdaSLionel Sambuc  * and AMR_CMD_EXT_ENQUIRY2 (2).
183*7eb99bdaSLionel Sambuc  */
184*7eb99bdaSLionel Sambuc struct amr_enquiry {
185*7eb99bdaSLionel Sambuc 	struct		amr_adapter_info ae_adapter;		/* e x 2 */
186*7eb99bdaSLionel Sambuc 	struct		amr_logdrive_info ae_ldrv;		/* e x 2 */
187*7eb99bdaSLionel Sambuc 	struct		amr_physdrive_info ae_pdrv;		/* e x 2 */
188*7eb99bdaSLionel Sambuc 	u_int8_t	ae_formatting[AMR_8LD_MAXDRIVES];	/*   x 2 */
189*7eb99bdaSLionel Sambuc 	u_int8_t	res1[AMR_8LD_MAXDRIVES];		/*   x 2 */
190*7eb99bdaSLionel Sambuc 	u_int32_t	ae_extlen;				/*     2 */
191*7eb99bdaSLionel Sambuc 	u_int16_t	ae_subsystem;				/*     2 */
192*7eb99bdaSLionel Sambuc 	u_int16_t	ae_subvendor;				/*     2 */
193*7eb99bdaSLionel Sambuc 	u_int32_t	ae_signature;				/*     2 */
194*7eb99bdaSLionel Sambuc #define	AMR_SIG_431	0xfffe0001
195*7eb99bdaSLionel Sambuc #define	AMR_SIG_438	0xfffd0002
196*7eb99bdaSLionel Sambuc #define	AMR_SIG_762	0xfffc0003
197*7eb99bdaSLionel Sambuc #define	AMR_SIG_T5	0xfffb0004
198*7eb99bdaSLionel Sambuc #define	AMR_SIG_466	0xfffa0005
199*7eb99bdaSLionel Sambuc #define	AMR_SIG_467	0xfff90006
200*7eb99bdaSLionel Sambuc #define	AMR_SIG_T7	0xfff80007
201*7eb99bdaSLionel Sambuc #define	AMR_SIG_490	0xfff70008
202*7eb99bdaSLionel Sambuc 	u_int8_t	res2[844];				/*     2 */
203*7eb99bdaSLionel Sambuc } __packed;
204*7eb99bdaSLionel Sambuc 
205*7eb99bdaSLionel Sambuc /*
206*7eb99bdaSLionel Sambuc  * 40LD firmware interface.
207*7eb99bdaSLionel Sambuc  */
208*7eb99bdaSLionel Sambuc 
209*7eb99bdaSLionel Sambuc /* Array constraints. */
210*7eb99bdaSLionel Sambuc #define	AMR_40LD_MAXDRIVES	40
211*7eb99bdaSLionel Sambuc #define	AMR_40LD_MAXCHAN	16
212*7eb99bdaSLionel Sambuc #define	AMR_40LD_MAXTARG	16
213*7eb99bdaSLionel Sambuc #define	AMR_40LD_MAXPHYSDRIVES	256
214*7eb99bdaSLionel Sambuc 
215*7eb99bdaSLionel Sambuc /* Product information structure. */
216*7eb99bdaSLionel Sambuc struct amr_prodinfo {
217*7eb99bdaSLionel Sambuc 	u_int32_t	ap_size;		/* current size in bytes (not including resvd) */
218*7eb99bdaSLionel Sambuc 	u_int32_t	ap_configsig;		/* default is 0x00282008, indicating 0x28 maximum
219*7eb99bdaSLionel Sambuc 					 * logical drives, 0x20 maximum stripes and 0x08
220*7eb99bdaSLionel Sambuc 					 * maximum spans */
221*7eb99bdaSLionel Sambuc 	u_int8_t	ap_firmware[16];	/* printable identifiers */
222*7eb99bdaSLionel Sambuc 	u_int8_t	ap_bios[16];
223*7eb99bdaSLionel Sambuc 	u_int8_t	ap_product[80];
224*7eb99bdaSLionel Sambuc 	u_int8_t	ap_maxio;		/* maximum number of concurrent commands supported */
225*7eb99bdaSLionel Sambuc 	u_int8_t	ap_nschan;		/* number of SCSI channels present */
226*7eb99bdaSLionel Sambuc 	u_int8_t	ap_fcloops;		/* number of fibre loops present */
227*7eb99bdaSLionel Sambuc 	u_int8_t	ap_memtype;		/* memory type */
228*7eb99bdaSLionel Sambuc 	u_int32_t	ap_signature;
229*7eb99bdaSLionel Sambuc 	u_int16_t	ap_memsize;		/* onboard memory in MB */
230*7eb99bdaSLionel Sambuc 	u_int16_t	ap_subsystem;		/* subsystem identifier */
231*7eb99bdaSLionel Sambuc 	u_int16_t	ap_subvendor;		/* subsystem vendor ID */
232*7eb99bdaSLionel Sambuc 	u_int8_t	ap_numnotifyctr;	/* number of notify counters */
233*7eb99bdaSLionel Sambuc } __packed;
234*7eb99bdaSLionel Sambuc 
235*7eb99bdaSLionel Sambuc /* Notify structure. */
236*7eb99bdaSLionel Sambuc struct amr_notify {
237*7eb99bdaSLionel Sambuc 	u_int32_t	an_globalcounter;	/* change counter */
238*7eb99bdaSLionel Sambuc 
239*7eb99bdaSLionel Sambuc 	u_int8_t	an_paramcounter;	/* parameter change counter */
240*7eb99bdaSLionel Sambuc 	u_int8_t	an_paramid;
241*7eb99bdaSLionel Sambuc #define	AMR_PARAM_REBUILD_RATE		0x01	/* value = new rebuild rate */
242*7eb99bdaSLionel Sambuc #define	AMR_PARAM_FLUSH_INTERVAL	0x02	/* value = new flush interval */
243*7eb99bdaSLionel Sambuc #define	AMR_PARAM_SENSE_ALERT		0x03	/* value = last physical drive with check condition set */
244*7eb99bdaSLionel Sambuc #define	AMR_PARAM_DRIVE_INSERTED	0x04	/* value = last physical drive inserted */
245*7eb99bdaSLionel Sambuc #define	AMR_PARAM_BATTERY_STATUS	0x05	/* value = battery status */
246*7eb99bdaSLionel Sambuc 	u_int16_t	an_paramval;
247*7eb99bdaSLionel Sambuc 
248*7eb99bdaSLionel Sambuc 	u_int8_t	an_writeconfigcounter;	/* write config occurred */
249*7eb99bdaSLionel Sambuc 	u_int8_t	res1[3];
250*7eb99bdaSLionel Sambuc 
251*7eb99bdaSLionel Sambuc 	u_int8_t	an_ldrvopcounter;	/* logical drive operation started/completed */
252*7eb99bdaSLionel Sambuc 	u_int8_t	an_ldrvopid;
253*7eb99bdaSLionel Sambuc 	u_int8_t	an_ldrvopcmd;
254*7eb99bdaSLionel Sambuc #define	AMR_LDRVOP_CHECK	0x01
255*7eb99bdaSLionel Sambuc #define	AMR_LDRVOP_INIT		0x02
256*7eb99bdaSLionel Sambuc #define	AMR_LDRVOP_REBUILD	0x03
257*7eb99bdaSLionel Sambuc 	u_int8_t	an_ldrvopstatus;
258*7eb99bdaSLionel Sambuc #define	AMR_LDRVOP_SUCCESS	0x00
259*7eb99bdaSLionel Sambuc #define	AMR_LDRVOP_FAILED	0x01
260*7eb99bdaSLionel Sambuc #define	AMR_LDRVOP_ABORTED	0x02
261*7eb99bdaSLionel Sambuc #define	AMR_LDRVOP_CORRECTED	0x03
262*7eb99bdaSLionel Sambuc #define	AMR_LDRVOP_STARTED	0x04
263*7eb99bdaSLionel Sambuc 
264*7eb99bdaSLionel Sambuc 	u_int8_t	an_ldrvstatecounter;	/* logical drive state change occurred */
265*7eb99bdaSLionel Sambuc 	u_int8_t	an_ldrvstateid;
266*7eb99bdaSLionel Sambuc 	u_int8_t	an_ldrvstatenew;
267*7eb99bdaSLionel Sambuc 	u_int8_t	an_ldrvstateold;
268*7eb99bdaSLionel Sambuc 
269*7eb99bdaSLionel Sambuc 	u_int8_t	an_pdrvstatecounter;	/* physical drive state change occurred */
270*7eb99bdaSLionel Sambuc 	u_int8_t	an_pdrvstateid;
271*7eb99bdaSLionel Sambuc 	u_int8_t	an_pdrvstatenew;
272*7eb99bdaSLionel Sambuc 	u_int8_t	an_pdrvstateold;
273*7eb99bdaSLionel Sambuc 
274*7eb99bdaSLionel Sambuc 	u_int8_t	an_pdrvfmtcounter;
275*7eb99bdaSLionel Sambuc 	u_int8_t	an_pdrvfmtid;
276*7eb99bdaSLionel Sambuc 	u_int8_t	an_pdrvfmtval;
277*7eb99bdaSLionel Sambuc #define	AMR_FORMAT_START	0x01
278*7eb99bdaSLionel Sambuc #define	AMR_FORMAT_COMPLETE	0x02
279*7eb99bdaSLionel Sambuc 	u_int8_t	res2;
280*7eb99bdaSLionel Sambuc 
281*7eb99bdaSLionel Sambuc 	u_int8_t	an_targxfercounter;	/* scsi xfer rate change */
282*7eb99bdaSLionel Sambuc 	u_int8_t	an_targxferid;
283*7eb99bdaSLionel Sambuc 	u_int8_t	an_targxferval;
284*7eb99bdaSLionel Sambuc 	u_int8_t	res3;
285*7eb99bdaSLionel Sambuc 
286*7eb99bdaSLionel Sambuc 	u_int8_t	an_fcloopidcounter;	/* FC/AL loop ID changed */
287*7eb99bdaSLionel Sambuc 	u_int8_t	an_fcloopidpdrvid;
288*7eb99bdaSLionel Sambuc 	u_int8_t	an_fcloopid0;
289*7eb99bdaSLionel Sambuc 	u_int8_t	an_fcloopid1;
290*7eb99bdaSLionel Sambuc 
291*7eb99bdaSLionel Sambuc 	u_int8_t	an_fcloopstatecounter;	/* FC/AL loop status changed */
292*7eb99bdaSLionel Sambuc 	u_int8_t	an_fcloopstate0;
293*7eb99bdaSLionel Sambuc 	u_int8_t	an_fcloopstate1;
294*7eb99bdaSLionel Sambuc 	u_int8_t	res4;
295*7eb99bdaSLionel Sambuc } __packed;
296*7eb99bdaSLionel Sambuc 
297*7eb99bdaSLionel Sambuc /* Enquiry3 structure. */
298*7eb99bdaSLionel Sambuc struct amr_enquiry3 {
299*7eb99bdaSLionel Sambuc 	u_int32_t	ae_datasize;		/* valid data size in this structure */
300*7eb99bdaSLionel Sambuc 	union {				/* event notify structure */
301*7eb99bdaSLionel Sambuc 	struct amr_notify	n;
302*7eb99bdaSLionel Sambuc 	u_int8_t		pad[0x80];
303*7eb99bdaSLionel Sambuc 	} 		ae_notify;
304*7eb99bdaSLionel Sambuc 	u_int8_t	ae_rebuildrate;		/* current rebuild rate in % */
305*7eb99bdaSLionel Sambuc 	u_int8_t	ae_cacheflush;		/* flush interval in seconds */
306*7eb99bdaSLionel Sambuc 	u_int8_t	ae_sensealert;
307*7eb99bdaSLionel Sambuc 	u_int8_t	ae_driveinsertcount;	/* count of inserted drives */
308*7eb99bdaSLionel Sambuc 	u_int8_t	ae_batterystatus;
309*7eb99bdaSLionel Sambuc 	u_int8_t	ae_numldrives;
310*7eb99bdaSLionel Sambuc 	u_int8_t	ae_reconstate[AMR_40LD_MAXDRIVES / 8];	/* reconstruction state */
311*7eb99bdaSLionel Sambuc 	u_int16_t	ae_opstatus[AMR_40LD_MAXDRIVES / 8];	/* operation status per drive */
312*7eb99bdaSLionel Sambuc 	u_int32_t	ae_drivesize[AMR_40LD_MAXDRIVES];	/* logical drive size */
313*7eb99bdaSLionel Sambuc 	u_int8_t	ae_driveprop[AMR_40LD_MAXDRIVES];	/* logical drive properties */
314*7eb99bdaSLionel Sambuc 	u_int8_t	ae_drivestate[AMR_40LD_MAXDRIVES];	/* physical drive state */
315*7eb99bdaSLionel Sambuc 	u_int8_t	ae_pdrivestate[AMR_40LD_MAXPHYSDRIVES]; /* physical drive state */
316*7eb99bdaSLionel Sambuc 	u_int16_t	ae_driveformat[AMR_40LD_MAXPHYSDRIVES];
317*7eb99bdaSLionel Sambuc 	u_int8_t	ae_targxfer[80];			/* physical drive transfer rates */
318*7eb99bdaSLionel Sambuc 
319*7eb99bdaSLionel Sambuc 	u_int8_t	res1[263];		/* pad to 1024 bytes */
320*7eb99bdaSLionel Sambuc } __packed;
321*7eb99bdaSLionel Sambuc 
322*7eb99bdaSLionel Sambuc /*
323*7eb99bdaSLionel Sambuc  * Mailbox and command structures.
324*7eb99bdaSLionel Sambuc  */
325*7eb99bdaSLionel Sambuc 
326*7eb99bdaSLionel Sambuc struct amr_mailbox_cmd {
327*7eb99bdaSLionel Sambuc 	u_int8_t	mb_command;
328*7eb99bdaSLionel Sambuc 	u_int8_t	mb_ident;
329*7eb99bdaSLionel Sambuc 	u_int16_t	mb_blkcount;
330*7eb99bdaSLionel Sambuc 	u_int32_t	mb_lba;
331*7eb99bdaSLionel Sambuc 	u_int32_t	mb_physaddr;
332*7eb99bdaSLionel Sambuc 	u_int8_t	mb_drive;
333*7eb99bdaSLionel Sambuc 	u_int8_t	mb_nsgelem;
334*7eb99bdaSLionel Sambuc 	u_int8_t	res1;
335*7eb99bdaSLionel Sambuc 	u_int8_t	mb_busy;
336*7eb99bdaSLionel Sambuc } __packed;
337*7eb99bdaSLionel Sambuc 
338*7eb99bdaSLionel Sambuc struct amr_mailbox_resp {
339*7eb99bdaSLionel Sambuc 	u_int8_t	mb_nstatus;
340*7eb99bdaSLionel Sambuc 	u_int8_t	mb_status;
341*7eb99bdaSLionel Sambuc 	u_int8_t	mb_completed[46];
342*7eb99bdaSLionel Sambuc }  __packed;
343*7eb99bdaSLionel Sambuc 
344*7eb99bdaSLionel Sambuc struct amr_mailbox {
345*7eb99bdaSLionel Sambuc 	u_int32_t	mb_res1[3];
346*7eb99bdaSLionel Sambuc 	u_int32_t	mb_segment;
347*7eb99bdaSLionel Sambuc 	struct		amr_mailbox_cmd mb_cmd;
348*7eb99bdaSLionel Sambuc 	struct		amr_mailbox_resp mb_resp;
349*7eb99bdaSLionel Sambuc 	u_int8_t	mb_poll;
350*7eb99bdaSLionel Sambuc 	u_int8_t	mb_ack;
351*7eb99bdaSLionel Sambuc 	u_int8_t	res2[62];		/* Pad to 128+16 bytes. */
352*7eb99bdaSLionel Sambuc } __packed;
353*7eb99bdaSLionel Sambuc 
354*7eb99bdaSLionel Sambuc struct amr_mailbox_ioctl {
355*7eb99bdaSLionel Sambuc 	u_int8_t	mb_command;
356*7eb99bdaSLionel Sambuc 	u_int8_t	mb_ident;
357*7eb99bdaSLionel Sambuc 	u_int8_t	mb_channel;
358*7eb99bdaSLionel Sambuc 	u_int8_t	mb_param;
359*7eb99bdaSLionel Sambuc 	u_int8_t	mb_pad[4];
360*7eb99bdaSLionel Sambuc 	u_int32_t	mb_physaddr;
361*7eb99bdaSLionel Sambuc 	u_int8_t	mb_drive;
362*7eb99bdaSLionel Sambuc 	u_int8_t	mb_nsgelem;
363*7eb99bdaSLionel Sambuc 	u_int8_t	res1;
364*7eb99bdaSLionel Sambuc 	u_int8_t	mb_busy;
365*7eb99bdaSLionel Sambuc 	u_int8_t	mb_nstatus;
366*7eb99bdaSLionel Sambuc 	u_int8_t	mb_completed[46];
367*7eb99bdaSLionel Sambuc 	u_int8_t	mb_poll;
368*7eb99bdaSLionel Sambuc 	u_int8_t	mb_ack;
369*7eb99bdaSLionel Sambuc 	u_int8_t	res4[16];
370*7eb99bdaSLionel Sambuc } __packed;
371*7eb99bdaSLionel Sambuc 
372*7eb99bdaSLionel Sambuc struct amr_sgentry {
373*7eb99bdaSLionel Sambuc 	u_int32_t	sge_addr;
374*7eb99bdaSLionel Sambuc 	u_int32_t	sge_count;
375*7eb99bdaSLionel Sambuc } __packed;
376*7eb99bdaSLionel Sambuc 
377*7eb99bdaSLionel Sambuc struct amr_passthrough {
378*7eb99bdaSLionel Sambuc 	u_int8_t	ap_timeout:3;
379*7eb99bdaSLionel Sambuc 	u_int8_t	ap_ars:1;
380*7eb99bdaSLionel Sambuc 	u_int8_t	ap_dummy:3;
381*7eb99bdaSLionel Sambuc 	u_int8_t	ap_islogical:1;
382*7eb99bdaSLionel Sambuc 	u_int8_t	ap_logical_drive_no;
383*7eb99bdaSLionel Sambuc 	u_int8_t	ap_channel;
384*7eb99bdaSLionel Sambuc 	u_int8_t	ap_scsi_id;
385*7eb99bdaSLionel Sambuc 	u_int8_t	ap_queue_tag;
386*7eb99bdaSLionel Sambuc 	u_int8_t	ap_queue_action;
387*7eb99bdaSLionel Sambuc 	u_int8_t	ap_cdb[AMR_MAX_CDB_LEN];
388*7eb99bdaSLionel Sambuc 	u_int8_t	ap_cdb_length;
389*7eb99bdaSLionel Sambuc 	u_int8_t	ap_request_sense_length;
390*7eb99bdaSLionel Sambuc 	u_int8_t	ap_request_sense_area[AMR_MAX_REQ_SENSE_LEN];
391*7eb99bdaSLionel Sambuc 	u_int8_t	ap_no_sg_elements;
392*7eb99bdaSLionel Sambuc 	u_int8_t	ap_scsi_status;
393*7eb99bdaSLionel Sambuc 	u_int32_t	ap_data_transfer_address;
394*7eb99bdaSLionel Sambuc 	u_int32_t	ap_data_transfer_length;
395*7eb99bdaSLionel Sambuc } __packed;
396*7eb99bdaSLionel Sambuc 
397*7eb99bdaSLionel Sambuc /*
398*7eb99bdaSLionel Sambuc  * "Quartz" i960 PCI bridge interface.
399*7eb99bdaSLionel Sambuc  */
400*7eb99bdaSLionel Sambuc 
401*7eb99bdaSLionel Sambuc #define	AMR_QUARTZ_SIG_REG	0xa0
402*7eb99bdaSLionel Sambuc #define	AMR_QUARTZ_SIG0		0xcccc
403*7eb99bdaSLionel Sambuc #define	AMR_QUARTZ_SIG1		0x3344
404*7eb99bdaSLionel Sambuc 
405*7eb99bdaSLionel Sambuc /* Doorbell registers. */
406*7eb99bdaSLionel Sambuc #define	AMR_QREG_IDB		0x20
407*7eb99bdaSLionel Sambuc #define	AMR_QREG_ODB		0x2c
408*7eb99bdaSLionel Sambuc 
409*7eb99bdaSLionel Sambuc #define	AMR_QIDB_SUBMIT		0x00000001	/* mailbox ready for work */
410*7eb99bdaSLionel Sambuc #define	AMR_QIDB_ACK		0x00000002	/* mailbox done */
411*7eb99bdaSLionel Sambuc #define	AMR_QODB_READY		0x10001234	/* work ready to be processed */
412*7eb99bdaSLionel Sambuc 
413*7eb99bdaSLionel Sambuc /*
414*7eb99bdaSLionel Sambuc  * Old-style ("standard") ASIC bridge interface.
415*7eb99bdaSLionel Sambuc  */
416*7eb99bdaSLionel Sambuc 
417*7eb99bdaSLionel Sambuc /* I/O registers. */
418*7eb99bdaSLionel Sambuc #define	AMR_SREG_CMD		0x10	/* Command/ack register (w) */
419*7eb99bdaSLionel Sambuc #define	AMR_SREG_MBOX_BUSY	0x10	/* Mailbox status (r) */
420*7eb99bdaSLionel Sambuc #define	AMR_SREG_TOGL		0x11	/* Interrupt enable */
421*7eb99bdaSLionel Sambuc #define	AMR_SREG_MBOX		0x14	/* Mailbox physical address */
422*7eb99bdaSLionel Sambuc #define	AMR_SREG_MBOX_ENABLE	0x18	/* Atomic mailbox address enable */
423*7eb99bdaSLionel Sambuc #define	AMR_SREG_INTR		0x1a	/* Interrupt status */
424*7eb99bdaSLionel Sambuc 
425*7eb99bdaSLionel Sambuc /* I/O magic numbers. */
426*7eb99bdaSLionel Sambuc #define	AMR_SCMD_POST		0x10	/* in SCMD to initiate action on mailbox */
427*7eb99bdaSLionel Sambuc #define	AMR_SCMD_ACKINTR	0x08	/* in SCMD to ack mailbox retrieved */
428*7eb99bdaSLionel Sambuc #define	AMR_STOGL_ENABLE	0xc0	/* in STOGL */
429*7eb99bdaSLionel Sambuc #define	AMR_SINTR_VALID		0x40	/* in SINTR */
430*7eb99bdaSLionel Sambuc #define	AMR_SMBOX_BUSY_FLAG	0x10	/* in SMBOX_BUSY */
431*7eb99bdaSLionel Sambuc #define	AMR_SMBOX_ENABLE_ADDR	0x00	/* in SMBOX_ENABLE */
432*7eb99bdaSLionel Sambuc 
433*7eb99bdaSLionel Sambuc #endif	/* !_PCI_AMRREG_H_ */
434