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