xref: /freebsd/sys/dev/ips/ipsreg.h (revision df67b5c13378dd1376884f453bf323b26f7e1634)
1f94dfeb4SScott Long /*-
2f94dfeb4SScott Long  * Copyright (c) 2002 Adaptec Inc.
3f94dfeb4SScott Long  * All rights reserved.
4f94dfeb4SScott Long  *
5f94dfeb4SScott Long  * Written by: David Jeffery
6f94dfeb4SScott Long  *
7f94dfeb4SScott Long  * Redistribution and use in source and binary forms, with or without
8f94dfeb4SScott Long  * modification, are permitted provided that the following conditions
9f94dfeb4SScott Long  * are met:
10f94dfeb4SScott Long  * 1. Redistributions of source code must retain the above copyright
11f94dfeb4SScott Long  *    notice, this list of conditions and the following disclaimer.
12f94dfeb4SScott Long  * 2. Redistributions in binary form must reproduce the above copyright
13f94dfeb4SScott Long  *    notice, this list of conditions and the following disclaimer in the
14f94dfeb4SScott Long  *    documentation and/or other materials provided with the distribution.
15f94dfeb4SScott Long  *
16f94dfeb4SScott Long  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17f94dfeb4SScott Long  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18f94dfeb4SScott Long  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19f94dfeb4SScott Long  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20f94dfeb4SScott Long  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21f94dfeb4SScott Long  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22f94dfeb4SScott Long  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23f94dfeb4SScott Long  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24f94dfeb4SScott Long  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25f94dfeb4SScott Long  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26f94dfeb4SScott Long  * SUCH DAMAGE.
27f94dfeb4SScott Long  *
28f94dfeb4SScott Long  * $FreeBSD$
29f94dfeb4SScott Long  */
30f94dfeb4SScott Long 
31f94dfeb4SScott Long #include <sys/param.h>
32f94dfeb4SScott Long 
33f94dfeb4SScott Long /*
34f94dfeb4SScott Long  *   IPS CONSTANTS
35f94dfeb4SScott Long  */
36f94dfeb4SScott Long #define IPS_VENDOR_ID                   0x1014
37f94dfeb4SScott Long #define IPS_VENDOR_ID_ADAPTEC		0x9005
38f94dfeb4SScott Long #define IPS_MORPHEUS_DEVICE_ID          0x01BD
39f94dfeb4SScott Long #define IPS_COPPERHEAD_DEVICE_ID        0x002E
40f94dfeb4SScott Long #define IPS_MARCO_DEVICE_ID		0x0250
41f94dfeb4SScott Long #define IPS_CSL				0xff
42f94dfeb4SScott Long #define IPS_POCL			0x30
43f94dfeb4SScott Long 
44f94dfeb4SScott Long /* amounts of memory to allocate for certain commands */
45f94dfeb4SScott Long #define IPS_ADAPTER_INFO_LEN		(sizeof(ips_adapter_info_t))
46f94dfeb4SScott Long #define IPS_DRIVE_INFO_LEN		(sizeof(ips_drive_info_t))
47f94dfeb4SScott Long #define IPS_COMMAND_LEN			24
48f94dfeb4SScott Long #define IPS_MAX_SG_LEN			(sizeof(ips_sg_element_t) * IPS_MAX_SG_ELEMENTS)
49f94dfeb4SScott Long #define IPS_NVRAM_PAGE_SIZE		128
50f94dfeb4SScott Long /* various flags */
51f94dfeb4SScott Long #define IPS_STATIC_FLAG			0x01
52f94dfeb4SScott Long 
53f94dfeb4SScott Long /* states for the card to be in */
54f94dfeb4SScott Long #define IPS_DEV_OPEN			0x01
55f94dfeb4SScott Long #define IPS_TIMEOUT			0x02 /* command time out, need reset */
56f94dfeb4SScott Long #define IPS_OFFLINE			0x04 /* can't reset card/card failure */
57f94dfeb4SScott Long #define IPS_STATIC_BUSY			0x08
58f94dfeb4SScott Long 
59f94dfeb4SScott Long /* max number of commands set to something low for now */
60f94dfeb4SScott Long #define IPS_MAX_CMD_NUM			128
61f94dfeb4SScott Long #define IPS_MAX_NUM_DRIVES		8
62f94dfeb4SScott Long #define IPS_MAX_SG_ELEMENTS		32
63f94dfeb4SScott Long #define IPS_MAX_IOBUF_SIZE		(64 * 1024)
64f94dfeb4SScott Long #define IPS_BLKSIZE			512
65df67b5c1SScott Long #define IPS_MAX_LD			8
66df67b5c1SScott Long #define IPS_MAX_CHANNELS		4
67df67b5c1SScott Long #define IPS_MAX_TARGETS			15
68df67b5c1SScott Long #define IPS_MAX_CHUNKS			16
69f94dfeb4SScott Long 
70f94dfeb4SScott Long /* logical drive states */
71f94dfeb4SScott Long 
72f94dfeb4SScott Long #define IPS_LD_OFFLINE               	0x02
73f94dfeb4SScott Long #define IPS_LD_OKAY                  	0x03
74f94dfeb4SScott Long #define IPS_LD_DEGRADED			0x04
75f94dfeb4SScott Long #define IPS_LD_FREE                  	0x00
76f94dfeb4SScott Long #define IPS_LD_SYS                   	0x06
77f94dfeb4SScott Long #define IPS_LD_CRS                   	0x24
78f94dfeb4SScott Long 
79f94dfeb4SScott Long /* register offsets */
80f94dfeb4SScott Long #define MORPHEUS_REG_OMR0               0x0018 /* Outbound Msg. Reg. 0 */
81f94dfeb4SScott Long #define MORPHEUS_REG_OMR1               0x001C /* Outbound Msg. Reg. 1 */
82f94dfeb4SScott Long #define MORPHEUS_REG_IDR		0x0020 /* Inbound Doorbell Reg. */
83f94dfeb4SScott Long #define MORPHEUS_REG_IISR               0x0024 /* Inbound IRQ Status Reg. */
84f94dfeb4SScott Long #define MORPHEUS_REG_IIMR               0x0028 /* Inbound IRQ Mask Reg. */
85f94dfeb4SScott Long #define MORPHEUS_REG_OISR               0x0030 /* Outbound IRQ Status Reg. */
86f94dfeb4SScott Long #define MORPHEUS_REG_OIMR               0x0034 /* Outbound IRQ Mask Reg. */
87f94dfeb4SScott Long #define MORPHEUS_REG_IQPR               0x0040 /* Inbound Queue Port Reg. */
88f94dfeb4SScott Long #define MORPHEUS_REG_OQPR               0x0044 /* Outbound Queue Port Reg. */
89f94dfeb4SScott Long 
90f94dfeb4SScott Long #define COPPER_REG_SCPR			0x05	/* Subsystem Ctrl. Port Reg. */
91f94dfeb4SScott Long #define COPPER_REG_ISPR			0x06	/* IRQ Status Port Reg. */
92f94dfeb4SScott Long #define COPPER_REG_CBSP			0x07	/* ? Reg. */
93f94dfeb4SScott Long #define COPPER_REG_HISR			0x08	/* Host IRQ Status Reg.    */
94f94dfeb4SScott Long #define COPPER_REG_CCSAR		0x10	/* Cmd. Channel Sys Addr Reg.*/
95f94dfeb4SScott Long #define COPPER_REG_CCCR			0x14	/* Cmd. Channel Ctrl. Reg. */
96f94dfeb4SScott Long #define COPPER_REG_SQHR                	0x20    /* Status Queue Head Reg.  */
97f94dfeb4SScott Long #define COPPER_REG_SQTR                	0x24    /* Status Queue Tail Reg.  */
98f94dfeb4SScott Long #define COPPER_REG_SQER                	0x28    /* Status Queue End Reg.   */
99f94dfeb4SScott Long #define COPPER_REG_SQSR                	0x2C    /* Status Queue Start Reg. */
100f94dfeb4SScott Long 
101f94dfeb4SScott Long /* bit definitions */
102f94dfeb4SScott Long #define MORPHEUS_BIT_POST1              0x01
103f94dfeb4SScott Long #define MORPHEUS_BIT_POST2              0x02
104f94dfeb4SScott Long #define MORPHEUS_BIT_CMD_IRQ		0x08
105f94dfeb4SScott Long 
106f94dfeb4SScott Long #define COPPER_CMD_START		0x101A
107f94dfeb4SScott Long #define COPPER_SEM_BIT			0x08
108f94dfeb4SScott Long #define COPPER_EI_BIT			0x80
109f94dfeb4SScott Long #define COPPER_EBM_BIT			0x02
110f94dfeb4SScott Long #define COPPER_RESET_BIT		0x80
111f94dfeb4SScott Long #define COPPER_GHI_BIT			0x04
112f94dfeb4SScott Long #define COPPER_SCE_BIT			0x01
113f94dfeb4SScott Long #define COPPER_OP_BIT			0x01
114f94dfeb4SScott Long #define COPPER_ILE_BIT			0x10
115f94dfeb4SScott Long 
116f94dfeb4SScott Long /* status defines */
117f94dfeb4SScott Long #define IPS_POST1_OK                    0x8000
118f94dfeb4SScott Long #define IPS_POST2_OK                    0x000f
119f94dfeb4SScott Long 
120f94dfeb4SScott Long /* command op codes */
121f94dfeb4SScott Long #define IPS_READ_CMD			0x02
122f94dfeb4SScott Long #define IPS_WRITE_CMD			0x03
123f94dfeb4SScott Long #define IPS_ADAPTER_INFO_CMD		0x05
124f94dfeb4SScott Long #define IPS_CACHE_FLUSH_CMD		0x0A
125f94dfeb4SScott Long #define IPS_REBUILD_STATUS_CMD		0x0C
126f94dfeb4SScott Long #define IPS_ERROR_TABLE_CMD		0x17
127f94dfeb4SScott Long #define IPS_DRIVE_INFO_CMD		0x19
128df67b5c1SScott Long #define IPS_CMD_READ_CONF		0x38
129f94dfeb4SScott Long #define IPS_SUBSYS_PARAM_CMD		0x40
130f94dfeb4SScott Long #define IPS_CONFIG_SYNC_CMD		0x58
131f94dfeb4SScott Long #define IPS_SG_READ_CMD			0x82
132f94dfeb4SScott Long #define IPS_SG_WRITE_CMD		0x83
133f94dfeb4SScott Long #define IPS_RW_NVRAM_CMD		0xBC
134f94dfeb4SScott Long #define IPS_FFDC_CMD			0xD7
135f94dfeb4SScott Long 
136f94dfeb4SScott Long /* basic_status information returned by the adapter */
137f94dfeb4SScott Long #define IPS_MIN_ERROR			0x02
138f94dfeb4SScott Long #define IPS_BASIC_STATUS_MASK		0xFF
139f94dfeb4SScott Long #define IPS_GSC_STATUS_MASK		0x0F
140f94dfeb4SScott Long #define IPS_CMD_SUCCESS			0x00
141f94dfeb4SScott Long #define IPS_CMD_RECOVERED_ERROR		0x01
142f94dfeb4SScott Long #define IPS_DRV_ERROR			0x02	/* Driver supplied error */
143f94dfeb4SScott Long #define IPS_INVAL_OPCO			0x03
144f94dfeb4SScott Long #define IPS_INVAL_CMD_BLK		0x04
145f94dfeb4SScott Long #define IPS_INVAL_PARM_BLK		0x05
146f94dfeb4SScott Long #define IPS_BUSY			0x08
147f94dfeb4SScott Long #define IPS_CMD_CMPLT_WERROR		0x0C
148f94dfeb4SScott Long #define IPS_LD_ERROR			0x0D
149f94dfeb4SScott Long #define IPS_CMD_TIMEOUT			0x0E
150f94dfeb4SScott Long #define IPS_PHYS_DRV_ERROR		0x0F
151f94dfeb4SScott Long 
152f94dfeb4SScott Long /* extended_status information returned by the adapter */
153f94dfeb4SScott Long #define IPS_ERR_SEL_TO			0xF0
154f94dfeb4SScott Long #define IPS_ERR_OU_RUN			0xF2
155f94dfeb4SScott Long #define IPS_ERR_HOST_RESET		0xF7
156f94dfeb4SScott Long #define IPS_ERR_DEV_RESET		0xF8
157f94dfeb4SScott Long #define IPS_ERR_RECOVERY		0xFC
158f94dfeb4SScott Long #define IPS_ERR_CKCOND			0xFF
159f94dfeb4SScott Long 
160f94dfeb4SScott Long #define IPS_OS_FREEBSD			8
161f94dfeb4SScott Long #define IPS_VERSION_MAJOR		"0.90"
162f94dfeb4SScott Long #define IPS_VERSION_MINOR		".10"
163f94dfeb4SScott Long 
164f94dfeb4SScott Long /* Adapter Types */
165f94dfeb4SScott Long #define IPS_ADAPTER_COPPERHEAD		0x01
166f94dfeb4SScott Long #define IPS_ADAPTER_COPPERHEAD2		0x02
167f94dfeb4SScott Long #define IPS_ADAPTER_COPPERHEADOB1	0x03
168f94dfeb4SScott Long #define IPS_ADAPTER_COPPERHEADOB2	0x04
169f94dfeb4SScott Long #define IPS_ADAPTER_CLARINET		0x05
170f94dfeb4SScott Long #define IPS_ADAPTER_CLARINETLITE	0x06
171f94dfeb4SScott Long #define IPS_ADAPTER_TROMBONE		0x07
172f94dfeb4SScott Long #define IPS_ADAPTER_MORPHEUS		0x08
173f94dfeb4SScott Long #define IPS_ADAPTER_MORPHEUSLITE	0x09
174f94dfeb4SScott Long #define IPS_ADAPTER_NEO			0x0A
175f94dfeb4SScott Long #define IPS_ADAPTER_NEOLITE		0x0B
176f94dfeb4SScott Long #define IPS_ADAPTER_SARASOTA2		0x0C
177f94dfeb4SScott Long #define IPS_ADAPTER_SARASOTA1		0x0D
178f94dfeb4SScott Long #define IPS_ADAPTER_MARCO		0x0E
179f94dfeb4SScott Long #define IPS_ADAPTER_SEBRING		0x0F
180f94dfeb4SScott Long #define IPS_ADAPTER_MAX_T		IPS_ADAPTER_SEBRING
181f94dfeb4SScott Long 
182f94dfeb4SScott Long /* values for ffdc_settime (from gmtime) */
183f94dfeb4SScott Long #define IPS_SECSPERMIN      60
184f94dfeb4SScott Long #define IPS_MINSPERHOUR     60
185f94dfeb4SScott Long #define IPS_HOURSPERDAY     24
186f94dfeb4SScott Long #define IPS_DAYSPERWEEK     7
187f94dfeb4SScott Long #define IPS_DAYSPERNYEAR    365
188f94dfeb4SScott Long #define IPS_DAYSPERLYEAR    366
189f94dfeb4SScott Long #define IPS_SECSPERHOUR     (IPS_SECSPERMIN * IPS_MINSPERHOUR)
190f94dfeb4SScott Long #define IPS_SECSPERDAY      ((long) IPS_SECSPERHOUR * IPS_HOURSPERDAY)
191f94dfeb4SScott Long #define IPS_MONSPERYEAR     12
192f94dfeb4SScott Long #define IPS_EPOCH_YEAR      1970
193f94dfeb4SScott Long #define IPS_LEAPS_THRU_END_OF(y)    ((y) / 4 - (y) / 100 + (y) / 400)
194f94dfeb4SScott Long #define ips_isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
195f94dfeb4SScott Long 
196f94dfeb4SScott Long /*
197f94dfeb4SScott Long  *   IPS STRUCTS
198f94dfeb4SScott Long  */
199f94dfeb4SScott Long 
200f94dfeb4SScott Long typedef struct{
201f94dfeb4SScott Long 	u_int8_t	command;
202f94dfeb4SScott Long 	u_int8_t	id;
203f94dfeb4SScott Long 	u_int8_t	drivenum;
204f94dfeb4SScott Long 	u_int8_t	reserve2;
205f94dfeb4SScott Long 	u_int32_t	lba;
206f94dfeb4SScott Long 	u_int32_t	buffaddr;
207f94dfeb4SScott Long 	u_int32_t	reserve3;
208f94dfeb4SScott Long } __attribute__ ((packed)) ips_generic_cmd;
209f94dfeb4SScott Long 
210f94dfeb4SScott Long typedef struct{
211f94dfeb4SScott Long 	u_int8_t	command;
212f94dfeb4SScott Long 	u_int8_t	id;
213f94dfeb4SScott Long 	u_int8_t	drivenum;
214f94dfeb4SScott Long 	u_int8_t	segnum;
215f94dfeb4SScott Long 	u_int32_t	lba;
216f94dfeb4SScott Long 	u_int32_t	buffaddr;
217f94dfeb4SScott Long 	u_int16_t	length;
218f94dfeb4SScott Long 	u_int16_t	reserve1;
219f94dfeb4SScott Long } __attribute__ ((packed)) ips_io_cmd;
220f94dfeb4SScott Long 
221f94dfeb4SScott Long typedef struct{
222f94dfeb4SScott Long 	u_int8_t	command;
223f94dfeb4SScott Long 	u_int8_t	id;
224f94dfeb4SScott Long 	u_int8_t	pagenum;
225f94dfeb4SScott Long 	u_int8_t	rw;
226f94dfeb4SScott Long 	u_int32_t	reserve1;
227f94dfeb4SScott Long 	u_int32_t	buffaddr;
228f94dfeb4SScott Long 	u_int32_t	reserve3;
229f94dfeb4SScott Long } __attribute__ ((packed)) ips_rw_nvram_cmd;
230f94dfeb4SScott Long 
231f94dfeb4SScott Long typedef struct{
232f94dfeb4SScott Long 	u_int8_t	command;
233f94dfeb4SScott Long 	u_int8_t	id;
234f94dfeb4SScott Long 	u_int8_t	drivenum;
235f94dfeb4SScott Long 	u_int8_t	reserve1;
236f94dfeb4SScott Long 	u_int32_t	reserve2;
237f94dfeb4SScott Long 	u_int32_t	buffaddr;
238f94dfeb4SScott Long 	u_int32_t	reserve3;
239f94dfeb4SScott Long } __attribute__ ((packed)) ips_drive_cmd;
240f94dfeb4SScott Long 
241f94dfeb4SScott Long typedef struct{
242f94dfeb4SScott Long 	u_int8_t	command;
243f94dfeb4SScott Long 	u_int8_t	id;
244f94dfeb4SScott Long 	u_int8_t	reserve1;
245f94dfeb4SScott Long 	u_int8_t	commandtype;
246f94dfeb4SScott Long 	u_int32_t	reserve2;
247f94dfeb4SScott Long 	u_int32_t	buffaddr;
248f94dfeb4SScott Long 	u_int32_t	reserve3;
249f94dfeb4SScott Long } __attribute__((packed)) ips_adapter_info_cmd;
250f94dfeb4SScott Long 
251f94dfeb4SScott Long typedef struct{
252f94dfeb4SScott Long 	u_int8_t	command;
253f94dfeb4SScott Long 	u_int8_t	id;
254f94dfeb4SScott Long 	u_int8_t	reset_count;
255f94dfeb4SScott Long 	u_int8_t	reset_type;
256f94dfeb4SScott Long 	u_int8_t	second;
257f94dfeb4SScott Long 	u_int8_t	minute;
258f94dfeb4SScott Long 	u_int8_t	hour;
259f94dfeb4SScott Long 	u_int8_t	day;
260f94dfeb4SScott Long 	u_int8_t	reserve1[4];
261f94dfeb4SScott Long 	u_int8_t	month;
262f94dfeb4SScott Long 	u_int8_t	yearH;
263f94dfeb4SScott Long 	u_int8_t	yearL;
264f94dfeb4SScott Long 	u_int8_t	reserve2;
265f94dfeb4SScott Long } __attribute__((packed)) ips_adapter_ffdc_cmd;
266f94dfeb4SScott Long 
267f94dfeb4SScott Long typedef union{
268f94dfeb4SScott Long 	ips_generic_cmd		generic_cmd;
269f94dfeb4SScott Long 	ips_drive_cmd 		drive_cmd;
270f94dfeb4SScott Long 	ips_adapter_info_cmd 	adapter_info_cmd;
271f94dfeb4SScott Long } ips_cmd_buff_t;
272f94dfeb4SScott Long 
273f94dfeb4SScott Long typedef struct {
274f94dfeb4SScott Long    u_int32_t  signature;
275f94dfeb4SScott Long    u_int8_t   reserved;
276f94dfeb4SScott Long    u_int8_t   adapter_slot;
277f94dfeb4SScott Long    u_int16_t  adapter_type;
278f94dfeb4SScott Long    u_int8_t   bios_high[4];
279f94dfeb4SScott Long    u_int8_t   bios_low[4];
280f94dfeb4SScott Long    u_int16_t  reserve2;
281f94dfeb4SScott Long    u_int8_t   reserve3;
282f94dfeb4SScott Long    u_int8_t   operating_system;
283f94dfeb4SScott Long    u_int8_t   driver_high[4];
284f94dfeb4SScott Long    u_int8_t   driver_low[4];
285f94dfeb4SScott Long    u_int8_t   reserve4[100];
286f94dfeb4SScott Long }__attribute__((packed)) ips_nvram_page5;
287f94dfeb4SScott Long 
288f94dfeb4SScott Long typedef struct{
289f94dfeb4SScott Long 	u_int32_t	addr;
290f94dfeb4SScott Long 	u_int32_t	len;
291f94dfeb4SScott Long } ips_sg_element_t;
292f94dfeb4SScott Long 
293f94dfeb4SScott Long typedef struct{
294f94dfeb4SScott Long 	u_int8_t	drivenum;
295f94dfeb4SScott Long 	u_int8_t	merge_id;
296f94dfeb4SScott Long 	u_int8_t	raid_lvl;
297f94dfeb4SScott Long 	u_int8_t	state;
298f94dfeb4SScott Long 	u_int32_t	sector_count;
299f94dfeb4SScott Long } __attribute__((packed)) ips_drive_t;
300f94dfeb4SScott Long 
301f94dfeb4SScott Long typedef struct{
302f94dfeb4SScott Long 	u_int8_t	drivecount;
303f94dfeb4SScott Long 	u_int8_t	reserve1;
304f94dfeb4SScott Long 	u_int16_t	reserve2;
305f94dfeb4SScott Long 	ips_drive_t drives[IPS_MAX_NUM_DRIVES];
306f94dfeb4SScott Long }__attribute__((packed)) ips_drive_info_t;
307f94dfeb4SScott Long 
308f94dfeb4SScott Long typedef struct{
309f94dfeb4SScott Long 	u_int8_t	drivecount;
310f94dfeb4SScott Long 	u_int8_t	miscflags;
311f94dfeb4SScott Long 	u_int8_t	SLTflags;
312f94dfeb4SScott Long 	u_int8_t	BSTflags;
313f94dfeb4SScott Long 	u_int8_t	pwr_chg_count;
314f94dfeb4SScott Long 	u_int8_t	wrong_addr_count;
315f94dfeb4SScott Long 	u_int8_t	unident_count;
316f94dfeb4SScott Long 	u_int8_t	nvram_dev_chg_count;
317f94dfeb4SScott Long 	u_int8_t	codeblock_version[8];
318f94dfeb4SScott Long 	u_int8_t	bootblock_version[8];
319f94dfeb4SScott Long 	u_int32_t	drive_sector_count[IPS_MAX_NUM_DRIVES];
320f94dfeb4SScott Long 	u_int8_t	max_concurrent_cmds;
321f94dfeb4SScott Long 	u_int8_t	max_phys_devices;
322f94dfeb4SScott Long 	u_int16_t	flash_prog_count;
323f94dfeb4SScott Long 	u_int8_t	defunct_disks;
324f94dfeb4SScott Long 	u_int8_t	rebuildflags;
325f94dfeb4SScott Long 	u_int8_t	offline_drivecount;
326f94dfeb4SScott Long 	u_int8_t	critical_drivecount;
327f94dfeb4SScott Long 	u_int16_t	config_update_count;
328f94dfeb4SScott Long 	u_int8_t	blockedflags;
329f94dfeb4SScott Long 	u_int8_t	psdn_error;
330df67b5c1SScott Long 	u_int16_t	addr_dead_disk[IPS_MAX_CHANNELS][IPS_MAX_TARGETS];
331f94dfeb4SScott Long }__attribute__((packed)) ips_adapter_info_t;
332f94dfeb4SScott Long 
333df67b5c1SScott Long typedef struct {
334df67b5c1SScott Long 	u_int8_t	initiator;
335df67b5c1SScott Long 	u_int8_t	parameters;
336df67b5c1SScott Long 	u_int8_t	miscflag;
337df67b5c1SScott Long 	u_int8_t	state;
338df67b5c1SScott Long 	u_int32_t	blkcount;
339df67b5c1SScott Long 	u_int8_t	deviceid[28];
340df67b5c1SScott Long } __attribute__((packed)) ips_devstate_t;
341df67b5c1SScott Long 
342df67b5c1SScott Long /*
343df67b5c1SScott Long  * The states that a physical drive can be in.  The 'present' value can be
344df67b5c1SScott Long  * OR'd with the other values.
345df67b5c1SScott Long  */
346df67b5c1SScott Long #define IPS_DEVSTATE_PRESENT	0x81
347df67b5c1SScott Long #define IPS_DEVSTATE_REBUILD	0x02
348df67b5c1SScott Long #define IPS_DEVSTATE_SPARE	0x04
349df67b5c1SScott Long #define IPS_DEVSTATE_MEMBER	0x08
350df67b5c1SScott Long 
351df67b5c1SScott Long typedef struct {
352df67b5c1SScott Long 	u_int8_t	channel;
353df67b5c1SScott Long 	u_int8_t	target;
354df67b5c1SScott Long 	u_int16_t	reserved;
355df67b5c1SScott Long 	u_int32_t	startsectors;
356df67b5c1SScott Long 	u_int32_t	numsectors;
357df67b5c1SScott Long } __attribute__((packed)) ips_chunk_t;
358df67b5c1SScott Long 
359df67b5c1SScott Long typedef struct {
360df67b5c1SScott Long 	u_int16_t	userfield;
361df67b5c1SScott Long 	u_int8_t	state;
362df67b5c1SScott Long 	u_int8_t	raidcacheparam;
363df67b5c1SScott Long 	u_int8_t	numchunkunits;
364df67b5c1SScott Long 	u_int8_t	stripesize;
365df67b5c1SScott Long 	u_int8_t	params;
366df67b5c1SScott Long 	u_int8_t	reserved;
367df67b5c1SScott Long 	u_int32_t	ldsize;
368df67b5c1SScott Long 	ips_chunk_t	chunk[IPS_MAX_CHUNKS];
369df67b5c1SScott Long } __attribute__((packed)) ips_ld_t;
370df67b5c1SScott Long 
371df67b5c1SScott Long typedef struct {
372df67b5c1SScott Long 	u_int8_t	boarddisc[8];
373df67b5c1SScott Long 	u_int8_t	processor[8];
374df67b5c1SScott Long 	u_int8_t	numchantype;
375df67b5c1SScott Long 	u_int8_t	numhostinttype;
376df67b5c1SScott Long 	u_int8_t	compression;
377df67b5c1SScott Long 	u_int8_t	nvramtype;
378df67b5c1SScott Long 	u_int32_t	nvramsize;
379df67b5c1SScott Long } __attribute__((packed)) ips_hardware_t;
380df67b5c1SScott Long 
381df67b5c1SScott Long typedef struct {
382df67b5c1SScott Long 	u_int8_t	ldcount;
383df67b5c1SScott Long 	u_int8_t	day;
384df67b5c1SScott Long 	u_int8_t	month;
385df67b5c1SScott Long 	u_int8_t	year;
386df67b5c1SScott Long 	u_int8_t	initiatorid[4];
387df67b5c1SScott Long 	u_int8_t	hostid[12];
388df67b5c1SScott Long 	u_int8_t	timesign[8];
389df67b5c1SScott Long 	u_int32_t	useropt;
390df67b5c1SScott Long 	u_int16_t	userfield;
391df67b5c1SScott Long 	u_int8_t	rebuildrate;
392df67b5c1SScott Long 	u_int8_t	reserve;
393df67b5c1SScott Long 	ips_hardware_t	hardwaredisc;
394df67b5c1SScott Long 	ips_ld_t	ld[IPS_MAX_LD];
395df67b5c1SScott Long 	ips_devstate_t	dev[IPS_MAX_CHANNELS][IPS_MAX_TARGETS+1];
396df67b5c1SScott Long 	u_int8_t	reserved[512];
397df67b5c1SScott Long } __attribute__((packed)) ips_conf_t;
398df67b5c1SScott Long 
399f94dfeb4SScott Long typedef union {
400f94dfeb4SScott Long    struct {
401f94dfeb4SScott Long       u_int8_t  reserved;
402f94dfeb4SScott Long       u_int8_t  command_id;
403f94dfeb4SScott Long       u_int8_t  basic_status;
404f94dfeb4SScott Long       u_int8_t  extended_status;
405f94dfeb4SScott Long    } fields;
406f94dfeb4SScott Long    volatile u_int32_t    value;
407f94dfeb4SScott Long } ips_cmd_status_t;
408f94dfeb4SScott Long 
409