1/*
2 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
3 * Use is subject to license terms.
4 */
5
6#ifndef	_SYS_MPI_RAID_H
7#define	_SYS_MPI_RAID_H
8
9#pragma ident	"%Z%%M%	%I%	%E% SMI"
10
11#ifdef	__cplusplus
12extern "C" {
13#endif
14
15/*
16 * RAID Volume Request
17 */
18typedef struct msg_raid_action {
19	uint8_t			Action;
20	uint8_t			Reserved1;
21	uint8_t			ChainOffset;
22	uint8_t			Function;
23	uint8_t			VolumeID;
24	uint8_t			VolumeBus;
25	uint8_t			PhysDiskNum;
26	uint8_t			MsgFlags;
27	uint32_t		MsgContext;
28	uint32_t		Reserved2;
29	uint32_t		ActionDataWord;
30	sge_simple_union_t	ActionDataSGE;
31} msg_raid_action_t;
32
33
34/* RAID Volume Action values */
35
36#define	MPI_RAID_ACTION_STATUS				0x00
37#define	MPI_RAID_ACTION_INDICATOR_STRUCT		0x01
38#define	MPI_RAID_ACTION_CREATE_VOLUME			0x02
39#define	MPI_RAID_ACTION_DELETE_VOLUME			0x03
40#define	MPI_RAID_ACTION_DISABLE_VOLUME			0x04
41#define	MPI_RAID_ACTION_ENABLE_VOLUME			0x05
42#define	MPI_RAID_ACTION_QUIESCE_PHYS_IO			0x06
43#define	MPI_RAID_ACTION_ENABLE_PHYS_IO			0x07
44#define	MPI_RAID_ACTION_CHANGE_VOLUME_SETTINGS		0x08
45#define	MPI_RAID_ACTION_PHYSDISK_OFFLINE		0x0A
46#define	MPI_RAID_ACTION_PHYSDISK_ONLINE			0x0B
47#define	MPI_RAID_ACTION_CHANGE_PHYSDISK_SETTINGS	0x0C
48#define	MPI_RAID_ACTION_CREATE_PHYSDISK			0x0D
49#define	MPI_RAID_ACTION_DELETE_PHYSDISK			0x0E
50#define	MPI_RAID_ACTION_FAIL_PHYSDISK			0x0F
51#define	MPI_RAID_ACTION_REPLACE_PHYSDISK		0x10
52#define	MPI_RAID_ACTION_ACTIVATE_VOLUME			0x11
53#define	MPI_RAID_ACTION_INACTIVATE_VOLUME		0x12
54
55#define	MPI_RAID_ACTION_ADATA_DO_NOT_SYNC		0x00000001
56
57#define	MPI_RAID_ACTION_ADATA_KEEP_PHYS_DISKS		0x00000000
58#define	MPI_RAID_ACTION_ADATA_DEL_PHYS_DISKS		0x00000001
59
60/* RAID Volume reply message */
61
62typedef struct msg_raid_action_reply {
63	uint8_t			Action;
64	uint8_t			Reserved;
65	uint8_t			MsgLength;
66	uint8_t			Function;
67	uint8_t			VolumeID;
68	uint8_t			VolumeBus;
69	uint8_t			PhysDiskNum;
70	uint8_t			MsgFlags;
71	uint32_t		MsgContext;
72	uint16_t		ActionStatus;
73	uint16_t		IOCStatus;
74	uint32_t		IOCLogInfo;
75	uint32_t		VolumeStatus;
76	uint32_t		ActionData;
77} msg_raid_action_reply_t;
78
79
80/* RAID Volume reply ActionStatus values */
81
82#define	MPI_RAID_VOL_ASTATUS_SUCCESS		0x0000
83#define	MPI_RAID_VOL_ASTATUS_INVALID_ACTION	0x0001
84#define	MPI_RAID_VOL_ASTATUS_FAILURE		0x0002
85#define	MPI_RAID_VOL_ASTATUS_IN_PROGRESS	0x0003
86
87
88/* RAID Volume reply RAID Volume Indicator structure */
89
90typedef struct mpi_raid_vol_indicator {
91	uint64_t		TotalBlocks;
92	uint64_t		BlocksRemaining;
93} mpi_raid_vol_indicator_t;
94
95
96/*
97 * SCSI IO RAID Passthrough Request
98 */
99typedef struct msg_scsi_io_raid_pt_request {
100	uint8_t			PhysDiskNum;
101	uint8_t			Reserved1;
102	uint8_t			ChainOffset;
103	uint8_t			Function;
104	uint8_t			CDBLength;
105	uint8_t			SenseBufferLength;
106	uint8_t			Reserved2;
107	uint8_t			MsgFlags;
108	uint32_t		MsgContext;
109	uint8_t			LUN[8];
110	uint32_t		Control;
111	uint8_t			CDB[16];
112	uint32_t		DataLength;
113	uint32_t		SenseBufferLowAddr;
114	sge_io_union_t		SGL;
115} msg_scsi_io_raid_pt_request_t;
116
117
118/* SCSI IO RAID Passthrough reply structure */
119
120typedef struct msg_scsi_io_raid_pt_reply {
121	uint8_t			PhysDiskNum;
122	uint8_t			Reserved1;
123	uint8_t			MsgLength;
124	uint8_t			Function;
125	uint8_t			CDBLength;
126	uint8_t			SenseBufferLength;
127	uint8_t			Reserved2;
128	uint8_t			MsgFlags;
129	uint32_t		MsgContext;
130	uint8_t			SCSIStatus;
131	uint8_t			SCSIState;
132	uint16_t		IOCStatus;
133	uint32_t		IOCLogInfo;
134	uint32_t		TransferCount;
135	uint32_t		SenseCount;
136	uint32_t		ResponseInfo;
137} msg_scsi_io_raid_pt_reply_t;
138
139#ifdef	__cplusplus
140}
141#endif
142
143#endif	/* _SYS_MPI_RAID_H */
144