Print this page
LOCAL: mpt_sas: expose drive ID via ioctl
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/scsi/adapters/mpt_sas/mptsas_ioctl.h
+++ new/usr/src/uts/common/sys/scsi/adapters/mpt_sas/mptsas_ioctl.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 + * Copyright (c) 2012, Joyent, Inc. All rights reserved.
25 26 */
26 27
27 28 /*
28 29 * Copyright (c) 2000 to 2010, LSI Corporation.
29 30 * All rights reserved.
30 31 *
31 32 * Redistribution and use in source and binary forms of all code within
32 33 * this file that is exclusively owned by LSI, with or without
33 34 * modification, is permitted provided that, in addition to the CDDL 1.0
34 35 * License requirements, the following conditions are met:
35 36 *
36 37 * Neither the name of the author nor the names of its contributors may be
37 38 * used to endorse or promote products derived from this software without
38 39 * specific prior written permission.
39 40 *
40 41 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41 42 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42 43 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
43 44 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
44 45 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
45 46 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
46 47 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
47 48 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
48 49 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
49 50 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
50 51 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
51 52 * DAMAGE.
52 53 */
53 54
54 55 #ifndef _MPTSAS_IOCTL_H
55 56 #define _MPTSAS_IOCTL_H
56 57
57 58 #ifdef __cplusplus
58 59 extern "C" {
59 60 #endif
60 61
61 62 #include <sys/types.h>
62 63
63 64 #define MPTIOCTL ('I' << 8)
↓ open down ↓ |
29 lines elided |
↑ open up ↑ |
64 65 #define MPTIOCTL_GET_ADAPTER_DATA (MPTIOCTL | 1)
65 66 #define MPTIOCTL_UPDATE_FLASH (MPTIOCTL | 2)
66 67 #define MPTIOCTL_RESET_ADAPTER (MPTIOCTL | 3)
67 68 #define MPTIOCTL_PASS_THRU (MPTIOCTL | 4)
68 69 #define MPTIOCTL_EVENT_QUERY (MPTIOCTL | 5)
69 70 #define MPTIOCTL_EVENT_ENABLE (MPTIOCTL | 6)
70 71 #define MPTIOCTL_EVENT_REPORT (MPTIOCTL | 7)
71 72 #define MPTIOCTL_GET_PCI_INFO (MPTIOCTL | 8)
72 73 #define MPTIOCTL_DIAG_ACTION (MPTIOCTL | 9)
73 74 #define MPTIOCTL_REG_ACCESS (MPTIOCTL | 10)
75 +#define MPTIOCTL_GET_DISK_INFO (MPTIOCTL | 11)
76 +#define MPTIOCTL_LED_CONTROL (MPTIOCTL | 12)
74 77
75 78 /*
76 79 * The following are our ioctl() return status values. If everything went
77 80 * well, we return good status. If the buffer length sent to us is too short
78 81 * we return a status to tell the user.
79 82 */
80 83 #define MPTIOCTL_STATUS_GOOD 0
81 84 #define MPTIOCTL_STATUS_LEN_TOO_SHORT 1
82 85
83 86 typedef struct mptsas_pci_bits
84 87 {
85 88 union {
86 89 struct {
87 90 uint32_t DeviceNumber :5;
88 91 uint32_t FunctionNumber :3;
89 92 uint32_t BusNumber :24;
90 93 } bits;
91 94 uint32_t AsDWORD;
92 95 } u;
93 96 uint32_t PciSegmentId;
94 97 } mptsas_pci_bits_t;
95 98 /*
96 99 * The following is the MPTIOCTL_GET_ADAPTER_DATA data structure. This data
97 100 * structure is setup so that we hopefully are properly aligned for both
98 101 * 32-bit and 64-bit mode applications.
99 102 *
100 103 * Adapter Type - Value = 4 = SCSI Protocol through SAS-2 adapter
101 104 *
102 105 * MPI Port Number - The PCI Function number for this device
103 106 *
104 107 * PCI Device HW Id - The PCI device number for this device
105 108 *
106 109 */
107 110 #define MPTIOCTL_ADAPTER_TYPE_SAS2 4
108 111 typedef struct mptsas_adapter_data
109 112 {
110 113 uint32_t StructureLength;
111 114 uint32_t AdapterType;
112 115 uint32_t MpiPortNumber;
113 116 uint32_t PCIDeviceHwId;
114 117 uint32_t PCIDeviceHwRev;
115 118 uint32_t SubSystemId;
116 119 uint32_t SubsystemVendorId;
117 120 uint32_t Reserved1;
118 121 uint32_t MpiFirmwareVersion;
119 122 uint32_t BiosVersion;
120 123 uint8_t DriverVersion[32];
121 124 uint8_t Reserved2;
122 125 uint8_t ScsiId;
123 126 uint16_t Reserved3;
124 127 mptsas_pci_bits_t PciInformation;
125 128 } mptsas_adapter_data_t;
126 129
127 130
128 131 typedef struct mptsas_update_flash
129 132 {
130 133 uint64_t PtrBuffer;
131 134 uint32_t ImageChecksum;
132 135 uint32_t ImageOffset;
133 136 uint32_t ImageSize;
134 137 uint32_t ImageType;
135 138 } mptsas_update_flash_t;
136 139
137 140
138 141 #define MPTSAS_PASS_THRU_DIRECTION_NONE 0
139 142 #define MPTSAS_PASS_THRU_DIRECTION_READ 1
140 143 #define MPTSAS_PASS_THRU_DIRECTION_WRITE 2
141 144 #define MPTSAS_PASS_THRU_DIRECTION_BOTH 3
142 145
143 146 typedef struct mptsas_pass_thru
144 147 {
145 148 uint64_t PtrRequest;
146 149 uint64_t PtrReply;
147 150 uint64_t PtrData;
148 151 uint32_t RequestSize;
149 152 uint32_t ReplySize;
150 153 uint32_t DataSize;
151 154 uint32_t DataDirection;
152 155 uint64_t PtrDataOut;
153 156 uint32_t DataOutSize;
154 157 uint32_t Timeout;
155 158 } mptsas_pass_thru_t;
156 159
157 160
158 161 /*
159 162 * Event queue defines
160 163 */
161 164 #define MPTSAS_EVENT_QUEUE_SIZE (50) /* Max Events stored in driver */
162 165 #define MPTSAS_MAX_EVENT_DATA_LENGTH (48) /* Size of each event in Dwords */
163 166
164 167 typedef struct mptsas_event_query
165 168 {
166 169 uint16_t Entries;
167 170 uint16_t Reserved;
168 171 uint32_t Types[4];
169 172 } mptsas_event_query_t;
170 173
171 174 typedef struct mptsas_event_enable
172 175 {
173 176 uint32_t Types[4];
174 177 } mptsas_event_enable_t;
175 178
176 179 /*
177 180 * Event record entry for ioctl.
178 181 */
179 182 typedef struct mptsas_event_entry
180 183 {
181 184 uint32_t Type;
182 185 uint32_t Number;
183 186 uint32_t Data[MPTSAS_MAX_EVENT_DATA_LENGTH];
184 187 } mptsas_event_entry_t;
185 188
186 189 typedef struct mptsas_event_report
187 190 {
188 191 uint32_t Size;
189 192 mptsas_event_entry_t Events[1];
190 193 } mptsas_event_report_t;
191 194
192 195
193 196 typedef struct mptsas_pci_info
194 197 {
195 198 uint32_t BusNumber;
196 199 uint8_t DeviceNumber;
197 200 uint8_t FunctionNumber;
198 201 uint16_t InterruptVector;
199 202 uint8_t PciHeader[256];
200 203 } mptsas_pci_info_t;
201 204
202 205
203 206 typedef struct mptsas_diag_action
204 207 {
205 208 uint32_t Action;
206 209 uint32_t Length;
207 210 uint64_t PtrDiagAction;
208 211 uint32_t ReturnCode;
209 212 } mptsas_diag_action_t;
210 213
211 214 #define MPTSAS_FW_DIAGNOSTIC_UID_NOT_FOUND (0xFF)
212 215
213 216 #define MPTSAS_FW_DIAG_NEW (0x806E6577)
214 217
215 218 #define MPTSAS_FW_DIAG_TYPE_REGISTER (0x00000001)
216 219 #define MPTSAS_FW_DIAG_TYPE_UNREGISTER (0x00000002)
217 220 #define MPTSAS_FW_DIAG_TYPE_QUERY (0x00000003)
218 221 #define MPTSAS_FW_DIAG_TYPE_READ_BUFFER (0x00000004)
219 222 #define MPTSAS_FW_DIAG_TYPE_RELEASE (0x00000005)
220 223
221 224 #define MPTSAS_FW_DIAG_INVALID_UID (0x00000000)
222 225
223 226 #define MPTSAS_FW_DIAG_ERROR_SUCCESS (0x00000000)
224 227 #define MPTSAS_FW_DIAG_ERROR_FAILURE (0x00000001)
225 228 #define MPTSAS_FW_DIAG_ERROR_INVALID_PARAMETER (0x00000002)
226 229 #define MPTSAS_FW_DIAG_ERROR_POST_FAILED (0x00000010)
227 230 #define MPTSAS_FW_DIAG_ERROR_INVALID_UID (0x00000011)
228 231 #define MPTSAS_FW_DIAG_ERROR_RELEASE_FAILED (0x00000012)
229 232 #define MPTSAS_FW_DIAG_ERROR_NO_BUFFER (0x00000013)
230 233 #define MPTSAS_FW_DIAG_ERROR_ALREADY_RELEASED (0x00000014)
231 234
232 235
233 236 typedef struct mptsas_fw_diag_register
234 237 {
235 238 uint8_t ExtendedType;
236 239 uint8_t BufferType;
237 240 uint16_t ApplicationFlags;
238 241 uint32_t DiagnosticFlags;
239 242 uint32_t ProductSpecific[23];
240 243 uint32_t RequestedBufferSize;
241 244 uint32_t UniqueId;
242 245 } mptsas_fw_diag_register_t;
243 246
244 247 typedef struct mptsas_fw_diag_unregister
245 248 {
246 249 uint32_t UniqueId;
247 250 } mptsas_fw_diag_unregister_t;
248 251
249 252 #define MPTSAS_FW_DIAG_FLAG_APP_OWNED (0x0001)
250 253 #define MPTSAS_FW_DIAG_FLAG_BUFFER_VALID (0x0002)
251 254 #define MPTSAS_FW_DIAG_FLAG_FW_BUFFER_ACCESS (0x0004)
252 255
253 256 typedef struct mptsas_fw_diag_query
254 257 {
255 258 uint8_t ExtendedType;
256 259 uint8_t BufferType;
257 260 uint16_t ApplicationFlags;
258 261 uint32_t DiagnosticFlags;
259 262 uint32_t ProductSpecific[23];
260 263 uint32_t TotalBufferSize;
261 264 uint32_t DriverAddedBufferSize;
262 265 uint32_t UniqueId;
263 266 } mptsas_fw_diag_query_t;
264 267
265 268 typedef struct mptsas_fw_diag_release
266 269 {
267 270 uint32_t UniqueId;
268 271 } mptsas_fw_diag_release_t;
269 272
270 273 #define MPTSAS_FW_DIAG_FLAG_REREGISTER (0x0001)
271 274 #define MPTSAS_FW_DIAG_FLAG_FORCE_RELEASE (0x0002)
272 275
273 276 typedef struct mptsas_diag_read_buffer
274 277 {
275 278 uint8_t Status;
276 279 uint8_t Reserved;
277 280 uint16_t Flags;
278 281 uint32_t StartingOffset;
279 282 uint32_t BytesToRead;
280 283 uint32_t UniqueId;
281 284 uint32_t DataBuffer[1];
282 285 } mptsas_diag_read_buffer_t;
283 286
284 287 /*
285 288 * Register Access
286 289 */
287 290 #define REG_IO_READ 1
288 291 #define REG_IO_WRITE 2
↓ open down ↓ |
205 lines elided |
↑ open up ↑ |
289 292 #define REG_MEM_READ 3
290 293 #define REG_MEM_WRITE 4
291 294
292 295 typedef struct mptsas_reg_access
293 296 {
294 297 uint32_t Command;
295 298 uint32_t RegOffset;
296 299 uint32_t RegData;
297 300 } mptsas_reg_access_t;
298 301
302 +/*
303 + * Disk Toplogy Information
304 + */
305 +typedef struct mptsas_disk_info_t
306 +{
307 + uint64_t SasAddress;
308 + uint16_t Instance;
309 + uint16_t Enclosure;
310 + uint16_t Slot;
311 +} mptsas_disk_info_t;
312 +
313 +typedef struct mptsas_get_disk_info
314 +{
315 + uint16_t DiskCount;
316 + mptsas_disk_info_t *PtrDiskInfoArray;
317 + uint64_t DiskInfoArraySize;
318 +} mptsas_get_disk_info_t;
319 +
320 +#ifdef _KERNEL
321 +
322 +typedef struct mptsas_get_disk_info32
323 +{
324 + uint16_t DiskCount;
325 + caddr32_t PtrDiskInfoArray;
326 + uint64_t DiskInfoArraySize;
327 +} mptsas_get_disk_info32_t;
328 +
329 +#endif /* _KERNEL */
330 +
331 +/*
332 + * LED Control
333 + */
334 +
335 +typedef struct mptsas_led_control
336 +{
337 + uint8_t Command;
338 + uint16_t Enclosure;
339 + uint16_t Slot;
340 + uint8_t Led;
341 + uint8_t LedStatus;
342 +} mptsas_led_control_t;
343 +
344 +#define MPTSAS_LEDCTL_FLAG_SET 1
345 +#define MPTSAS_LEDCTL_FLAG_GET 2
346 +
347 +#define MPTSAS_LEDCTL_LED_IDENT 1
348 +#define MPTSAS_LEDCTL_LED_FAIL 2
349 +#define MPTSAS_LEDCTL_LED_OK2RM 3
350 +
299 351 #ifdef __cplusplus
300 352 }
301 353 #endif
302 354
303 355 #endif /* _MPTSAS_IOCTL_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX