xref: /illumos-gate/usr/src/uts/common/sys/mpt/mpi_ioc.h (revision 9164a50bf932130cbb5097a16f6986873ce0e6e5)
1 /*
2  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 #ifndef _SYS_MPI_IOC_H
7 #define	_SYS_MPI_IOC_H
8 
9 #ifdef	__cplusplus
10 extern "C" {
11 #endif
12 
13 /*
14  * IOCInit message
15  */
16 typedef struct msg_ioc_init {
17 	uint8_t			WhoInit;
18 	uint8_t			Reserved;
19 	uint8_t			ChainOffset;
20 	uint8_t			Function;
21 	uint8_t			Flags;
22 	uint8_t			MaxDevices;
23 	uint8_t			MaxBuses;
24 	uint8_t			MsgFlags;
25 	uint32_t		MsgContext;
26 	uint16_t		ReplyFrameSize;
27 	uint8_t			Reserved1[2];
28 	uint32_t		HostMfaHighAddr;
29 	uint32_t		SenseBufferHighAddr;
30 	/* following used in new mpi implementations */
31 	uint32_t		ReplyFifoHostSignalingAddr;
32 	sge_simple_union_t	HostPageBufferSGE;
33 	uint16_t		MsgVersion;
34 	uint16_t		HeaderVersion;
35 } msg_ioc_init_t;
36 
37 typedef struct msg_ioc_init_reply {
38 	uint8_t			WhoInit;
39 	uint8_t			Reserved;
40 	uint8_t			MsgLength;
41 	uint8_t			Function;
42 	uint8_t			Flags;
43 	uint8_t			MaxDevices;
44 	uint8_t			MaxBuses;
45 	uint8_t			MsgFlags;
46 	uint32_t		MsgContext;
47 	uint16_t		Reserved2;
48 	uint16_t		IOCStatus;
49 	uint32_t		IOCLogInfo;
50 } msg_ioc_init_reply_t;
51 
52 /*
53  *  WhoInit values
54  */
55 #define	MPI_WHOINIT_NO_ONE			0x00
56 #define	MPI_WHOINIT_SYSTEM_BIOS			0x01
57 #define	MPI_WHOINIT_ROM_BIOS			0x02
58 #define	MPI_WHOINIT_PCI_PEER			0x03
59 #define	MPI_WHOINIT_HOST_DRIVER			0x04
60 #define	MPI_WHOINIT_MANUFACTURER		0x05
61 
62 /*
63  * Flags values
64  */
65 #define	MPI_IOCINIT_FLAGS_DISCARD_FW_IMAGE		0x01
66 #define	MPI_IOCINIT_FLAGS_REPLY_FIFO_HOST_SIGNAL	0x02
67 
68 #define	MPI_IOCINIT_MSGVERSION_MAJOR_MASK	(0xFF00)
69 #define	MPI_IOCINIT_MSGVERSION_MAJOR_SHIFT	(8)
70 #define	MPI_IOCINIT_MSGVERSION_MINOR_MASK	(0x00FF)
71 #define	MPI_IOCINIT_MSGVERSION_MINOR_SHIFT	(0)
72 
73 #define	MPI_IOCINIT_HEADERVERSION_UNIT_MASK	(0xFF00)
74 #define	MPI_IOCINIT_HEADERVERSION_UNIT_SHIFT	(8)
75 #define	MPI_IOCINIT_HEADERVERSION_DEV_MASK	(0x00FF)
76 #define	MPI_IOCINIT_HEADERVERSION_DEV_SHIFT	(0)
77 
78 
79 /*
80  * IOC Facts message
81  */
82 typedef struct msg_ioc_facts {
83 	uint8_t			Reserved[2];
84 	uint8_t			ChainOffset;
85 	uint8_t			Function;
86 	uint8_t			Reserved1[3];
87 	uint8_t			MsgFlags;
88 	uint32_t		MsgContext;
89 } msg_ioc_facts_t;
90 
91 /*
92  * FW version
93  */
94 typedef struct mpi_fw_version_struct {
95 	uint8_t			Dev;
96 	uint8_t			Unit;
97 	uint8_t			Minor;
98 	uint8_t			Major;
99 } mpi_fw_version_struct_t;
100 
101 typedef union mpi_fw_version {
102 	mpi_fw_version_struct_t	Struct;
103 	uint32_t		Word;
104 } mpi_fw_version_t;
105 
106 /*
107  * IOC Facts Reply
108  */
109 typedef struct msg_ioc_facts_reply {
110 	uint16_t		MsgVersion;
111 	uint8_t			MsgLength;
112 	uint8_t			Function;
113 	uint16_t		HeaderVersion;
114 	uint8_t			IOCNumber;
115 	uint8_t			MsgFlags;
116 	uint32_t		MsgContext;
117 	uint16_t		IOCExceptions;
118 	uint16_t		IOCStatus;
119 	uint32_t		IOCLogInfo;
120 	uint8_t			MaxChainDepth;
121 	uint8_t			WhoInit;
122 	uint8_t			BlockSize;
123 	uint8_t			Flags;
124 	uint16_t		ReplyQueueDepth;
125 	uint16_t		RequestFrameSize;
126 	uint16_t		Reserved_0101_FWVersion; /* obsolete */
127 	uint16_t		ProductID;
128 	uint32_t		CurrentHostMfaHighAddr;
129 	uint16_t		GlobalCredits;
130 	uint8_t			NumberOfPorts;
131 	uint8_t			EventState;
132 	uint32_t		CurrentSenseBufferHighAddr;
133 	uint16_t		CurReplyFrameSize;
134 	uint8_t			MaxDevices;
135 	uint8_t			MaxBuses;
136 	uint32_t		FWImageSize;
137 	uint32_t		IOCCapabilities;
138 	mpi_fw_version_t	FWVersion;
139 	/* following used in newer mpi implementations */
140 	uint16_t		HighPriorityQueueDepth;
141 	uint16_t		Reserved2;
142 	sge_simple_union_t	HostPageBufferSGE;
143 } msg_ioc_facts_reply_t;
144 
145 #define	MPI_IOCFACTS_MSGVERSION_MAJOR_MASK	0xFF00
146 #define	MPI_IOCFACTS_MSGVERSION_MINOR_MASK	0x00FF
147 
148 #define	MPI_IOCFACTS_HEADERVERSION_UNIT_MASK	0xFF00
149 #define	MPI_IOCFACTS_HEADERVERSION_DEV_MASK	0x00FF
150 
151 #define	MPI_IOCFACTS_EXCEPT_CONFIG_CHECKSUM_FAIL	0x0001
152 #define	MPI_IOCFACTS_EXCEPT_RAID_CONFIG_INVALID		0x0002
153 #define	MPI_IOCFACTS_EXCEPT_FW_CHECKSUM_FAIL		0x0004
154 #define	MPI_IOCFACTS_EXCEPT_PERSISTENT_TABLE_FULL	0x0008
155 
156 #define	MPI_IOCFACTS_FLAGS_FW_DOWNLOAD_BOOT	0x01
157 
158 #define	MPI_IOCFACTS_EVENTSTATE_DISABLED	0x00
159 #define	MPI_IOCFACTS_EVENTSTATE_ENABLED		0x01
160 
161 #define	MPI_IOCFACTS_CAPABILITY_HIGH_PRI_Q		0x00000001
162 #define	MPI_IOCFACTS_CAPABILITY_REPLY_HOST_SIGNAL	0x00000002
163 #define	MPI_IOCFACTS_CAPABILITY_QUEUE_FULL_HANDLING	0x00000004
164 #define	MPI_IOCFACTS_CAPABILITY_DIAG_TRACE_BUFFER	0x00000008
165 #define	MPI_IOCFACTS_CAPABILITY_SNAPSHOT_BUFFER		0x00000010
166 #define	MPI_IOCFACTS_CAPABILITY_EXTENDED_BUFFER		0x00000020
167 #define	MPI_IOCFACTS_CAPABILITY_EEDP			0x00000040
168 
169 /*
170  * Port Facts message and Reply
171  */
172 typedef struct msg_port_facts {
173 	uint8_t			Reserved[2];
174 	uint8_t			ChainOffset;
175 	uint8_t			Function;
176 	uint8_t			Reserved1[2];
177 	uint8_t			PortNumber;
178 	uint8_t			MsgFlags;
179 	uint32_t		MsgContext;
180 } msg_port_facts_t;
181 
182 typedef struct msg_port_facts_reply {
183 	uint16_t		Reserved;
184 	uint8_t			MsgLength;
185 	uint8_t			Function;
186 	uint16_t		Reserved1;
187 	uint8_t			PortNumber;
188 	uint8_t			MsgFlags;
189 	uint32_t		MsgContext;
190 	uint16_t		Reserved2;
191 	uint16_t		IOCStatus;
192 	uint32_t		IOCLogInfo;
193 	uint8_t			Reserved3;
194 	uint8_t			PortType;
195 	uint16_t		MaxDevices;
196 	uint16_t		PortSCSIID;
197 	uint16_t		ProtocolFlags;
198 	uint16_t		MaxPostedCmdBuffers;
199 	uint16_t		MaxPersistentIDs;
200 	uint16_t		MaxLanBuckets;
201 	uint16_t		Reserved4;
202 	uint32_t		Reserved5;
203 } msg_port_facts_reply_t;
204 
205 /*
206  * PortTypes values
207  */
208 #define	MPI_PORTFACTS_PORTTYPE_INACTIVE		0x00
209 #define	MPI_PORTFACTS_PORTTYPE_SCSI		0x01
210 #define	MPI_PORTFACTS_PORTTYPE_FC		0x10
211 #define	MPI_PORTFACTS_PORTTYPE_ISCSI		0x20
212 #define	MPI_PORTFACTS_PORTTYPE_SAS		0x30
213 
214 /*
215  * ProtocolFlags values
216  */
217 #define	MPI_PORTFACTS_PROTOCOL_LOGBUSADDR	0x01
218 #define	MPI_PORTFACTS_PROTOCOL_LAN		0x02
219 #define	MPI_PORTFACTS_PROTOCOL_TARGET		0x04
220 #define	MPI_PORTFACTS_PROTOCOL_INITIATOR	0x08
221 
222 /*
223  * Port Enable Message
224  */
225 typedef struct msg_port_enable {
226 	uint8_t			Reserved[2];
227 	uint8_t			ChainOffset;
228 	uint8_t			Function;
229 	uint8_t			Reserved1[2];
230 	uint8_t			PortNumber;
231 	uint8_t			MsgFlags;
232 	uint32_t		MsgContext;
233 } msg_port_enable_t;
234 
235 typedef struct msg_port_enable_reply {
236 	uint8_t			Reserved[2];
237 	uint8_t			MsgLength;
238 	uint8_t			Function;
239 	uint8_t			Reserved1[2];
240 	uint8_t			PortNumber;
241 	uint8_t			MsgFlags;
242 	uint32_t		MsgContext;
243 	uint16_t		Reserved2;
244 	uint16_t		IOCStatus;
245 	uint32_t		IOCLogInfo;
246 } msg_port_enable_reply_t;
247 
248 
249 /*
250  * Event Notification messages
251  */
252 typedef struct msg_event_notify {
253 	uint8_t			Switch;
254 	uint8_t			Reserved;
255 	uint8_t			ChainOffset;
256 	uint8_t			Function;
257 	uint8_t			Reserved1[3];
258 	uint8_t			MsgFlags;
259 	uint32_t		MsgContext;
260 } msg_event_notify_t;
261 
262 /*
263  * Event Notification Reply
264  */
265 typedef struct msg_event_notify_reply {
266 	uint16_t		EventDataLength;
267 	uint8_t			MsgLength;
268 	uint8_t			Function;
269 	uint8_t			Reserved1[2];
270 	uint8_t			AckRequired;
271 	uint8_t			MsgFlags;
272 	uint32_t		MsgContext;
273 	uint8_t			Reserved2[2];
274 	uint16_t		IOCStatus;
275 	uint32_t		IOCLogInfo;
276 	uint32_t		Event;
277 	uint32_t		EventContext;
278 	uint32_t		Data[1];
279 } msg_event_notify_reply_t;
280 
281 /*
282  * Event Acknowledge
283  */
284 typedef struct msg_event_ack {
285 	uint8_t			Reserved[2];
286 	uint8_t			ChainOffset;
287 	uint8_t			Function;
288 	uint8_t			Reserved1[3];
289 	uint8_t			MsgFlags;
290 	uint32_t		MsgContext;
291 	uint32_t		Event;
292 	uint32_t		EventContext;
293 } msg_event_ack_t;
294 
295 typedef struct msg_event_ack_reply {
296 	uint8_t			Reserved[2];
297 	uint8_t			Function;
298 	uint8_t			MsgLength;
299 	uint8_t			Reserved1[3];
300 	uint8_t			MsgFlags;
301 	uint32_t		MsgContext;
302 	uint16_t		Reserved2;
303 	uint16_t		IOCStatus;
304 	uint32_t		IOCLogInfo;
305 } msg_event_ack_reply_t;
306 
307 /*
308  * Switch
309  */
310 #define	MPI_EVENT_NOTIFICATION_SWITCH_OFF	0x00
311 #define	MPI_EVENT_NOTIFICATION_SWITCH_ON	0x01
312 
313 /*
314  * Event
315  */
316 #define	MPI_EVENT_NONE				0x00000000
317 #define	MPI_EVENT_LOG_DATA			0x00000001
318 #define	MPI_EVENT_STATE_CHANGE			0x00000002
319 #define	MPI_EVENT_UNIT_ATTENTION		0x00000003
320 #define	MPI_EVENT_IOC_BUS_RESET			0x00000004
321 #define	MPI_EVENT_EXT_BUS_RESET			0x00000005
322 #define	MPI_EVENT_RESCAN			0x00000006
323 #define	MPI_EVENT_LINK_STATUS_CHANGE		0x00000007
324 #define	MPI_EVENT_LOOP_STATE_CHANGE		0x00000008
325 #define	MPI_EVENT_LOGOUT			0x00000009
326 #define	MPI_EVENT_EVENT_CHANGE			0x0000000A
327 #define	MPI_EVENT_INTEGRATED_RAID		0x0000000B
328 #define	MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE	0x0000000C
329 #define	MPI_EVENT_ON_BUS_TIMER_EXPIRED		0x0000000D
330 #define	MPI_EVENT_QUEUE_FULL			0x0000000E
331 #define	MPI_EVENT_SAS_DEVICE_STATUS_CHANGE	0x0000000F
332 #define	MPI_EVENT_SAS_SES			0x00000010
333 #define	MPI_EVENT_PERSISTENT_TABLE_FULL		0x00000011
334 #define	MPI_EVENT_SAS_PHY_LINK_STATUS		0x00000012
335 #define	MPI_EVENT_SAS_DISCOVERY_ERROR		0x00000013
336 #define	MPI_EVENT_IR_RESYNC_UPDATE		0x00000014
337 #define	MPI_EVENT_IR2				0x00000015
338 #define	MPI_EVENT_SAS_DISCOVERY			0x00000016
339 #define	MPI_EVENT_SAS_BROADCAST_PRIMITIVE	0x00000017
340 #define	MPI_EVENT_SAS_INIT_DEVICE_STATUS_CHANGE	0x00000018
341 #define	MPI_EVENT_SAS_INIT_TABLE_OVERFLOW	0x00000019
342 #define	MPI_EVENT_SAS_SMP_ERROR			0x0000001A
343 #define	MPI_EVENT_SAS_EXPANDER_STATUS_CHANGE	0x0000001B
344 #define	MPI_EVENT_LOG_ENTRY_ADDED		0x00000021
345 
346 /*
347  * AckRequired field values
348  */
349 #define	MPI_EVENT_NOTIFICATION_ACK_NOT_REQUIRED	0x00
350 #define	MPI_EVENT_NOTIFICATION_ACK_REQUIRED	0x01
351 
352 /*
353  * Eventchange event data
354  */
355 typedef struct event_data_event_change {
356 	uint8_t			EventState;
357 	uint8_t			Reserved;
358 	uint16_t		Reserved1;
359 } event_data_event_change_t;
360 
361 /*
362  * SCSI Event data for Port, Bus and Device forms)
363  */
364 typedef struct event_data_scsi {
365 	uint8_t			TargetID;
366 	uint8_t			BusPort;
367 	uint16_t		Reserved;
368 } event_data_scsi_t;
369 
370 /*
371  * SCSI Device Status Change Event data
372  */
373 typedef struct event_data_scsi_device_status_change {
374 	uint8_t			TargetID;
375 	uint8_t			Bus;
376 	uint8_t			ReasonCode;
377 	uint8_t			LUN;
378 	uint8_t			ASC;
379 	uint8_t			ASCQ;
380 	uint16_t		Reserved;
381 } event_data_scsi_device_status_change_t;
382 
383 /*
384  * SCSI Device Status Change Event data ReasonCode values
385  */
386 #define	MPI_EVENT_SCSI_DEV_STAT_RC_ADDED		0x03
387 #define	MPI_EVENT_SCSI_DEV_STAT_RC_NOT_RESPONDING	0x04
388 #define	MPI_EVENT_SCSI_DEV_STAT_RC_SMART_DATA		0x05
389 
390 /*
391  * SAS Device Status Change event data
392  */
393 typedef struct event_data_sas_device_status_change {
394 	uint8_t		TargetID;
395 	uint8_t		Bus;
396 	uint8_t		ReasonCode;
397 	uint8_t		Reserved;
398 	uint8_t		ASC;
399 	uint8_t		ASCQ;
400 	uint16_t	DevHandle;
401 	uint32_t	DeviceInfo;
402 	uint16_t	ParentDevHandle;
403 	uint8_t		PhyNum;
404 	uint8_t		Reserved1;
405 	uint64_t	SASAddress;
406 } event_data_sas_device_status_change_t;
407 
408 #define	MPI_EVENT_SAS_DEV_STAT_RC_ADDED			0x03
409 #define	MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING	0x04
410 #define	MPI_EVENT_SAS_DEV_STAT_RC_SMART_DATA		0x05
411 #define	MPI_EVENT_SAS_DEV_STAT_RC_NO_PERSIST_ADDED	0x06
412 
413 /*
414  * SCSI event data for queue full event
415  */
416 typedef struct event_data_queue_full {
417 	uint8_t		TargetID;
418 	uint8_t		Bus;
419 	uint16_t	CurrentDepth;
420 } event_data_queue_full_t;
421 
422 /*
423  * MPI Link Status Change Event data
424  */
425 typedef struct event_data_link_status {
426 	uint8_t			State;
427 	uint8_t			Reserved;
428 	uint16_t		Reserved1;
429 	uint8_t			Reserved2;
430 	uint8_t			Port;
431 	uint16_t		Reserved3;
432 } event_data_link_status_t;
433 
434 #define	MPI_EVENT_LINK_STATUS_FAILURE		0x00000000
435 #define	MPI_EVENT_LINK_STATUS_ACTIVE		0x00000001
436 
437 /* MPI Loop State Change Event data */
438 
439 typedef struct event_data_loop_state {
440 	uint8_t			Character4;
441 	uint8_t			Character3;
442 	uint8_t			Type;
443 	uint8_t			Reserved;
444 	uint8_t			Reserved1;
445 	uint8_t			Port;
446 	uint16_t		Reserved2;
447 } event_data_loop_state_t;
448 
449 #define	MPI_EVENT_LOOP_STATE_CHANGE_LIP		0x0001
450 #define	MPI_EVENT_LOOP_STATE_CHANGE_LPE		0x0002
451 #define	MPI_EVENT_LOOP_STATE_CHANGE_LPB		0x0003
452 
453 /*
454  * MPI LOGOUT Event data
455  */
456 typedef struct event_data_logout {
457 	uint32_t		NPortID;
458 	uint8_t			Reserved;
459 	uint8_t			Port;
460 	uint16_t		Reserved1;
461 } event_data_logout_t;
462 
463 /*
464  * MPI RAID Status Change Event Data
465  */
466 typedef struct event_data_raid {
467 	uint8_t			VolumeID;
468 	uint8_t			VolumeBus;
469 	uint8_t			ReasonCode;
470 	uint8_t			PhysDiskNum;
471 	uint8_t			ASC;
472 	uint8_t			ASCQ;
473 	uint16_t		Reserved;
474 	uint32_t		SettingsStatus;
475 } event_data_raid_t;
476 
477 /* MPI RAID Status Change Event data ReasonCode values */
478 #define	MPI_EVENT_RAID_RC_VOLUME_CREATED		0x00
479 #define	MPI_EVENT_RAID_RC_VOLUME_DELETED		0x01
480 #define	MPI_EVENT_RAID_RC_VOLUME_SETTINGS_CHANGED	0x02
481 #define	MPI_EVENT_RAID_RC_VOLUME_STATUS_CHANGED		0x03
482 #define	MPI_EVENT_RAID_RC_VOLUME_PHYSDISK_CHANGED	0x04
483 #define	MPI_EVENT_RAID_RC_PHYSDISK_CREATED		0x05
484 #define	MPI_EVENT_RAID_RC_PHYSDISK_DELETED		0x06
485 #define	MPI_EVENT_RAID_RC_PHYSDISK_SETTINGS_CHANGED	0x07
486 #define	MPI_EVENT_RAID_RC_PHYSDISK_STATUS_CHANGED	0x08
487 #define	MPI_EVENT_RAID_RC_DOMAIN_VAL_NEEDED		0x09
488 #define	MPI_EVENT_RAID_RC_SMART_DATA			0x0A
489 #define	MPI_EVENT_RAID_RC_REPLACE_ACTION_STARTED	0x0B
490 
491 /*
492  * SAS Phy link down event data
493  */
494 typedef struct event_data_sas_phy_link_status {
495 	uint8_t		PhyNum;
496 	uint8_t		LinkRates;
497 	uint16_t	DevHandle;
498 	uint64_t	SASAddress;
499 } event_data_sas_phy_link_status_t;
500 
501 #define	MPI_EVENT_SAS_PLS_LR_CURRENT_MASK			0xF0
502 #define	MPI_EVENT_SAS_PLS_LR_CURRENT_SHIFT			4
503 #define	MPI_EVENT_SAS_PLS_LR_PREVIOUS_MASK			0x0F
504 #define	MPI_EVENT_SAS_PLS_LR_PREVIOUS_SHIFT			0
505 #define	MPI_EVENT_SAS_PLS_LR_RATE_UNKNOWN			0x00
506 #define	MPI_EVENT_SAS_PLS_LR_RATE_PHY_DISABLED			0x01
507 #define	MPI_EVENT_SAS_PLS_LR_RATE_FAILED_SPEED_NEGOTIATION	0x02
508 #define	MPI_EVENT_SAS_PLS_LR_RATE_SATA_OOB_COMPLETE		0x03
509 #define	MPI_EVENT_SAS_PLS_LR_RATE_1_5				0x08
510 #define	MPI_EVENT_SAS_PLS_LR_RATE_3_0				0x09
511 
512 /*
513  * sas discovery error structure
514  */
515 typedef struct event_data_sas_discovery_error {
516 	uint32_t	DiscoveryStatus;
517 	uint8_t		Port;
518 	uint8_t		Reserved[3];
519 } event_data_sas_discovery_error_t;
520 
521 /*
522  * values for DiscoveryStatus field of SAS Discovery Error Event Data
523  */
524 
525 #define	MPI_EVENT_SAS_DE_DS_LOOP_DETECTED		0x00000001
526 #define	MPI_EVENT_SAS_DE_DS_UNADDRESSABLE_DEVICE	0x00000002
527 #define	MPI_EVENT_SAS_DE_DS_MULTIPLE_PORTS		0x00000004
528 #define	MPI_EVENT_SAS_DE_DS_EXPANDER_ERR		0x00000008
529 #define	MPI_EVENT_SAS_DE_DS_SMP_TIMEOUT			0x00000010
530 #define	MPI_EVENT_SAS_DE_DS_OUT_ROUTE_ENTRIES		0x00000020
531 #define	MPI_EVENT_SAS_DE_DS_INDEX_NOT_EXIST		0x00000040
532 #define	MPI_EVENT_SAS_DE_DS_SMP_FUNCTION_FAILED		0x00000080
533 #define	MPI_EVENT_SAS_DE_DS_SMP_CRC_ERR			0x00000100
534 #define	MPI_EVENT_SAS_DE_DS_MULTIPLE_SUBTRACTIVE	0x00000200
535 #define	MPI_EVENT_SAS_DE_DS_TABLE_TO_TABLE		0x00000400
536 #define	MPI_EVENT_SAS_DE_DS_MULTIPLE_PATHS		0x00000800
537 #define	MPI_EVENT_SAS_DE_DS_MAX_SATA_TARGS		0x00001000
538 
539 typedef struct event_data_sas_expander_status_change {
540 	uint8_t		ReasonCode;
541 	uint8_t		Reserved1;
542 	uint16_t	Reserved2;
543 	uint8_t		PhysicalPort;
544 	uint8_t		Reserved3;
545 	uint16_t	EnclosureHandle;
546 	uint64_t	SASAddress;
547 	uint32_t	DiscoveryStatus;
548 	uint16_t	DevHandle;
549 	uint16_t	ParentDevHandle;
550 	uint16_t	ExpanderChangeCount;
551 	uint16_t	ExpanderRouteIndexes;
552 	uint8_t		NumPhys;
553 	uint8_t		SASLevel;
554 	uint8_t		Flags;
555 	uint8_t		Reserved4;
556 } event_data_sas_expander_status_change_t;
557 
558 /*
559  * values for ReasonCode field of SAS Expander Status Change Event data
560  */
561 #define	MPI_EVENT_SAS_EXP_RC_ADDED		0x00
562 #define	MPI_EVENT_SAS_EXP_RC_NOT_RESPONDING	0x01
563 
564 /*
565  * values for DiscoveryStatus field of SAS Expander Status Change Event data
566  */
567 #define	MPI_EVENT_SAS_EXP_DS_LOOP_DETECTED		0x00000001
568 #define	MPI_EVENT_SAS_EXP_DS_UNADDRESSABLE_DEVICE	0x00000002
569 #define	MPI_EVENT_SAS_EXP_DS_MULTIPLE_PORTS		0x00000004
570 #define	MPI_EVENT_SAS_EXP_DS_EXPANDER_ERR		0x00000008
571 #define	MPI_EVENT_SAS_EXP_DS_SMP_TIMEOUT		0x00000010
572 #define	MPI_EVENT_SAS_EXP_DS_OUT_ROUTE_ENTRIES		0x00000020
573 #define	MPI_EVENT_SAS_EXP_DS_INDEX_NOT_EXIST		0x00000040
574 #define	MPI_EVENT_SAS_EXP_DS_SMP_FUNCTION_FAILED	0x00000080
575 #define	MPI_EVENT_SAS_EXP_DS_SMP_CRC_ERROR		0x00000100
576 #define	MPI_EVENT_SAS_EXP_DS_SUBTRACTIVE_LINK		0x00000200
577 #define	MPI_EVENT_SAS_EXP_DS_TABLE_LINK			0x00000400
578 #define	MPI_EVENT_SAS_EXP_DS_UNSUPPORTED_DEVICE		0x00000800
579 
580 /*
581  *  values for Flags field of SAS Expander Status Change Event data
582  */
583 #define	MPI_EVENT_SAS_EXP_FLAGS_ROUTE_TABLE_CONFIG	0x02
584 #define	MPI_EVENT_SAS_EXP_FLAGS_CONFIG_IN_PROGRESS	0x01
585 
586 
587 /*
588  * Firmware Load Messages
589  */
590 
591 /*
592  * Firmware download message and associated structures
593  */
594 typedef struct msg_fw_download {
595 	uint8_t			ImageType;
596 	uint8_t			Reserved;
597 	uint8_t			ChainOffset;
598 	uint8_t			Function;
599 	uint8_t			Reserved1[3];
600 	uint8_t			MsgFlags;
601 	uint32_t		MsgContext;
602 	sge_mpi_union_t		SGL;
603 } msg_fw_download_t;
604 
605 #define	MPI_FW_DOWNLOAD_MSGFLGS_LAST_SEGMENT	0x01
606 
607 #define	MPI_FW_DOWNLOAD_ITYPE_RESERVED		0x00
608 #define	MPI_FW_DOWNLOAD_ITYPE_FW		0x01
609 #define	MPI_FW_DOWNLOAD_ITYPE_BIOS		0x02
610 #define	MPI_FW_DOWNLOAD_ITYPE_NVDATA		0x03
611 #define	MPI_FW_DOWNLOAD_ITYPE_BOOTLOADER	0x04
612 
613 typedef struct fw_download_tcsge {
614 	uint8_t			Reserved;
615 	uint8_t			ContextSize;
616 	uint8_t			DetailsLength;
617 	uint8_t			Flags;
618 	uint32_t		Reserved_0100_Checksum; /* obsolete */
619 	uint32_t		ImageOffset;
620 	uint32_t		ImageSize;
621 } fw_download_tcsge_t;
622 
623 typedef struct msg_fw_download_reply {
624 	uint8_t			ImageType;
625 	uint8_t			Reserved;
626 	uint8_t			MsgLength;
627 	uint8_t			Function;
628 	uint8_t			Reserved1[3];
629 	uint8_t			MsgFlags;
630 	uint32_t		MsgContext;
631 	uint16_t		Reserved2;
632 	uint16_t		IOCStatus;
633 	uint32_t		IOCLogInfo;
634 } msg_fw_download_reply_t;
635 
636 /*
637  * Firmware upload messages and associated structures
638  */
639 typedef struct msg_fw_upload {
640 	uint8_t			ImageType;
641 	uint8_t			Reserved;
642 	uint8_t			ChainOffset;
643 	uint8_t			Function;
644 	uint8_t			Reserved1[3];
645 	uint8_t			MsgFlags;
646 	uint32_t		MsgContext;
647 	sge_mpi_union_t		SGL;
648 } msg_fw_upload_t;
649 
650 #define	MPI_FW_UPLOAD_ITYPE_FW_IOC_MEM	0x00
651 #define	MPI_FW_UPLOAD_ITYPE_FW_FLASH	0x01
652 #define	MPI_FW_UPLOAD_ITYPE_BIOS_FLASH	0x02
653 #define	MPI_FW_UPLOAD_ITYPE_NVDATA	0x03
654 #define	MPI_FW_UPLOAD_ITYPE_BOOTLOADER	0x04
655 
656 typedef struct fw_upload_tcsge {
657 	uint8_t			Reserved;
658 	uint8_t			ContextSize;
659 	uint8_t			DetailsLength;
660 	uint8_t			Flags;
661 	uint32_t		Reserved1;
662 	uint32_t		ImageOffset;
663 	uint32_t		ImageSize;
664 } fw_upload_tcsge_t;
665 
666 typedef struct msg_fw_upload_reply {
667 	uint8_t			ImageType;
668 	uint8_t			Reserved;
669 	uint8_t			MsgLength;
670 	uint8_t			Function;
671 	uint8_t			Reserved1[3];
672 	uint8_t			MsgFlags;
673 	uint32_t		MsgContext;
674 	uint16_t		Reserved2;
675 	uint16_t		IOCStatus;
676 	uint32_t		IOCLogInfo;
677 	uint32_t		ActualImageSize;
678 } msg_fw_upload_reply_t;
679 
680 typedef struct msg_fw_header {
681 	uint32_t		ArmBranchInstruction0;
682 	uint32_t		Signature0;
683 	uint32_t		Signature1;
684 	uint32_t		Signature2;
685 	uint32_t		ArmBranchInstruction1;
686 	uint32_t		ArmBranchInstruction2;
687 	uint32_t		Reserved;
688 	uint32_t		Checksum;
689 	uint16_t		VendorId;
690 	uint16_t		ProductId;
691 	mpi_fw_version_t	FWVersion;
692 	uint32_t		SeqCodeVersion;
693 	uint32_t		ImageSize;
694 	uint32_t		NextImageHeaderOffset;
695 	uint32_t		LoadStartAddress;
696 	uint32_t		IopResetVectorValue;
697 	uint32_t		IopResetRegAddr;
698 	uint32_t		VersionNameWhat;
699 	uint8_t			VersionName[32];
700 	uint32_t		VendorNameWhat;
701 	uint8_t			VendorName[32];
702 } msg_fw_header_t;
703 
704 #define	MPI_FW_HEADER_WHAT_SIGNATURE			0x29232840
705 
706 /* defines for using the ProductId field */
707 #define	MPI_FW_HEADER_PID_TYPE_MASK			0xF000
708 #define	MPI_FW_HEADER_PID_TYPE_SCSI			0x0000
709 #define	MPI_FW_HEADER_PID_TYPE_FC			0x1000
710 
711 #define	MPI_FW_HEADER_PID_PROD_MASK			0x0F00
712 #define	MPI_FW_HEADER_PID_PROD_INITIATOR_SCSI		0x0100
713 #define	MPI_FW_HEADER_PID_PROD_TARGET_INITIATOR_SCSI	0x0200
714 #define	MPI_FW_HEADER_PID_PROD_TARGET_SCSI		0x0300
715 #define	MPI_FW_HEADER_PID_PROD_IM_SCSI			0x0400
716 #define	MPI_FW_HEADER_PID_PROD_IS_SCSI			0x0500
717 #define	MPI_FW_HEADER_PID_PROD_CTX_SCSI			0x0600
718 #define	MPI_FW_HEADER_PID_PROD_IR_SCSI			0x0700
719 
720 #define	MPI_FW_HEADER_PID_FAMILY_MASK			0x00FF
721 #define	MPI_FW_HEADER_PID_FAMILY_1030A0_SCSI		0x0001
722 #define	MPI_FW_HEADER_PID_FAMILY_1030B0_SCSI		0x0002
723 #define	MPI_FW_HEADER_PID_FAMILY_1030B1_SCSI		0x0003
724 #define	MPI_FW_HEADER_PID_FAMILY_1030C0_SCSI		0x0004
725 #define	MPI_FW_HEADER_PID_FAMILY_1020A0_SCSI		0x0005
726 #define	MPI_FW_HEADER_PID_FAMILY_1020B0_SCSI		0x0006
727 #define	MPI_FW_HEADER_PID_FAMILY_1020B1_SCSI		0x0007
728 #define	MPI_FW_HEADER_PID_FAMILY_1020C0_SCSI		0x0008
729 #define	MPI_FW_HEADER_PID_FAMILY_1035A0_SCSI		0x0009
730 #define	MPI_FW_HEADER_PID_FAMILY_1035B0_SCSI		0x000A
731 #define	MPI_FW_HEADER_PID_FAMILY_1030TA0_SCSI		0x000B
732 #define	MPI_FW_HEADER_PID_FAMILY_1020TA0_SCSI		0x000C
733 #define	MPI_FW_HEADER_PID_FAMILY_909_FC			0x0000
734 #define	MPI_FW_HEADER_PID_FAMILY_919_FC			0x0001
735 #define	MPI_FW_HEADER_PID_FAMILY_919X_FC		0x0002
736 #define	MPI_FW_HEADER_PID_FAMILY_1064_SAS		0x0001
737 #define	MPI_FW_HEADER_PID_FAMILY_1068_SAS		0x0002
738 #define	MPI_FW_HEADER_PID_FAMILY_1078_SAS		0x0003
739 
740 typedef struct mpi_ext_image_header {
741 	uint8_t			ImageType;
742 	uint8_t			Reserved;
743 	uint16_t		Reserved1;
744 	uint32_t		Checksum;
745 	uint32_t		ImageSize;
746 	uint32_t		NextImageHeaderOffset;
747 	uint32_t		LoadStartAddress;
748 	uint32_t		Reserved2;
749 } mpi_ext_image_header_t;
750 
751 #define	MPI_EXT_IMAGE_TYPE_UNSPECIFIED			0x00
752 #define	MPI_EXT_IMAGE_TYPE_FW				0x01
753 #define	MPI_EXT_IMAGE_TYPE_NVDATA			0x03
754 #define	MPI_EXT_IMAGE_TYPE_BOOTLOADER			0x04
755 
756 #ifdef	__cplusplus
757 }
758 #endif
759 
760 #endif	/* _SYS_MPI_IOC_H */
761