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