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