xref: /illumos-gate/usr/src/lib/storage/common/stgcom.h (revision fcf3ce441efd61da9bb2884968af01cb7c1452cc)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*
27  * Common definitions for Storage Utilities libraries
28  */
29 
30 #ifndef	_STGCOM_H
31 #define	_STGCOM_H
32 
33 
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 /*
40  * This header file contains the error definitions
41  * to handle the SCSI, path format, Device, Fibre Channel
42  * ioctl, Enclosure, and IB specific Errors.  It also
43  * contains physical names for device paths.
44  */
45 
46 /*
47  * Define for physical name of children of fcp
48  */
49 #define	FC_CTLR			":devctl"
50 #define	DRV_NAME_SD		"sd@"
51 #define	DRV_NAME_SSD		"ssd@"
52 #define	DRV_NAME_ST		"st@"
53 #define	SLSH_DRV_NAME_SD	"/sd@"
54 #define	SLSH_DRV_NAME_SSD	"/ssd@"
55 #define	SLSH_DRV_NAME_ST	"/st@"
56 #define	DRV_PART_NAME		",0:c,raw"
57 #define	SES_NAME		"ses@"
58 #define	SLSH_SES_NAME		"/ses@"
59 #define	SLASH_SES		"/ses"
60 #define	SES_DIR			"/dev/es"
61 #define	DEV_DSK_DIR		"/dev/dsk"
62 #define	DEV_RDIR		"/dev/rdsk"
63 #define	DEV_TAPE_DIR		"/dev/rmt"
64 #define	L_ARCH_4M		"sun4m"
65 #define	VHCI_NODE		"/devices/scsi_vhci:devctl"
66 #define	SCSI_VHCI		"/devices/scsi_vhci/"
67 #define	SLSH_VHCI_DISK		"/ssd@g"
68 
69 /*
70  * controller/nexus node postfix strings
71  */
72 #define	CTLR_POSTFIX	":ctlr"
73 #define	DEVCTL_POSTFIX	":devctl"
74 
75 /*
76  * I18N message number ranges
77  *  This file: 15500 - 15999
78  *  Shared common messages: 1 - 1999
79  */
80 
81 /*
82  * All error numbers below this base value
83  * are assumed to be UNIX error codes.
84  */
85 
86 #define	L_BASE				L_SCSI_ERROR
87 
88 /*
89  * SCSI Errors
90  *
91  */
92 /* SCSI error */
93 #define	L_SCSI_ERROR			0x10000
94 
95 /* Receive Diagnostics: Transfer length is not word aligned */
96 #define	L_RD_INVLD_TRNSFR_LEN		0x11002
97 
98 /* No disk element found in Receive diag. page */
99 #define	L_RD_NO_DISK_ELEM		0x11003
100 
101 /* Illegal mode sense page length */
102 #define	L_ILLEGAL_MODE_SENSE_PAGE	0x11004
103 
104 /* Invalid number of ENV. SENSE pages */
105 #define	L_INVALID_NO_OF_ENVSEN_PAGES	0x11005
106 
107 /* Buffer is *too* small to hold more than 8 pages */
108 #define	L_INVALID_BUF_LEN		0x11006
109 
110 /* Scsi_vhci errors */
111 #define	L_SCSI_VHCI_ERROR		0x11007
112 #define	L_SCSI_VHCI_ALREADY_ACTIVE	0x11008
113 #define	L_SCSI_VHCI_NO_STANDBY		0x11009
114 #define	L_SCSI_VHCI_FAILOVER_NOTSUP	0x1100a
115 #define	L_SCSI_VHCI_FAILOVER_BUSY	0x1100b
116 
117 
118 /*
119  * Error definitions
120  * for Format Errors.
121  */
122 #define	L_INVALID_PATH			0x20200
123 
124 /* Failed to open a given path */
125 #define	L_OPEN_PATH_FAIL		0x20001
126 
127 /* Invalid password length. */
128 #define	L_INVALID_PASSWORD_LEN		0x20002
129 
130 /* Given disk physical path is not valid. */
131 #define	L_INVLD_PHYS_PATH_TO_DISK	0x20004
132 
133 /* Invalid name id found in the physical path */
134 #define	L_INVLD_ID_FOUND		0x20005
135 
136 /* Invalid WWN format found */
137 #define	L_INVLD_WWN_FORMAT		0x20006
138 
139 /* No WWN found in the disk's physical path */
140 #define	L_NO_WWN_FOUND_IN_PATH		0x20007
141 
142 /* No Loop address found in the phys path */
143 #define	L_NO_LOOP_ADDRS_FOUND		0x20008
144 
145 /* Invalid port number found in the phys path */
146 #define	L_INVLD_PORT_IN_PATH		0x20009
147 
148 /* Invalid LED request */
149 #define	L_INVALID_LED_RQST		0x20010
150 
151 /* Invalid path format */
152 #define	L_INVALID_PATH_FORMAT		0x20011
153 
154 /* failed to get the physical path */
155 #define	L_NO_PHYS_PATH			0x20012
156 
157 /* failed to get the ses path */
158 #define	L_NO_SES_PATH			0x20015
159 
160 /* No "/" found in the physical path */
161 #define	L_INVLD_PATH_NO_SLASH_FND	0x20100
162 
163 /* No "@" found in the physical path */
164 #define	L_INVLD_PATH_NO_ATSIGN_FND	0x20101
165 
166 /* Invalid slot (slot < 0 or slot > 10). */
167 #define	L_INVALID_SLOT			0x20102
168 
169 /* No valid path to a device */
170 #define	L_NO_VALID_PATH			0x20103
171 
172 /* No disk devices found in /dev/rdsk directory */
173 #define	L_NO_DISK_DEV_FOUND		0x20104
174 
175 /* No tape devices found in /dev/rmt directory */
176 #define	L_NO_TAPE_DEV_FOUND		0x20105
177 
178 /* Device's Node WWN not found in the WWN list. */
179 #define	L_NO_NODE_WWN_IN_WWNLIST	0x20106
180 
181 /* Device's Node WWN not found in the Box list. */
182 #define	L_NO_NODE_WWN_IN_BOXLIST	0x20107
183 
184 /* Null WWN list found. */
185 #define	L_NULL_WWN_LIST			0x20108
186 
187 /* No devices found. */
188 #define	L_NO_DEVICES_FOUND		0x20109
189 
190 /* function arg error in wwn_list process */
191 #define	L_PROC_WWN_ARG_ERROR		0x20110
192 
193 /* WWN property not found */
194 #define	L_NO_WWN_PROP_FOUND		0x20111
195 
196 /* No driver nodes found for requested driver */
197 #define	L_NO_DRIVER_NODES_FOUND		0x20112
198 
199 /* ULP error on device(s) */
200 #define	L_GET_DEV_LIST_ULP_FAILURE	0x20150
201 
202 /*
203  * Error definitions
204  * for FC Loop (FC4 devices).
205  */
206 /* Invalid loop map found */
207 #define	L_INVALID_LOOP_MAP		0x20202
208 
209 /* SFIOCGMAP ioctl failed */
210 #define	L_SFIOCGMAP_IOCTL_FAIL		0x20203
211 
212 /* FCIO_GETMAP ioctl failed */
213 #define	L_FCIO_GETMAP_IOCTL_FAIL	0x20204
214 
215 /* FCIO_LINKSTATUS ioctl failed */
216 #define	L_FCIO_LINKSTATUS_FAILED	0x20205
217 
218 /* FCIO_GETMAP: Invalid # of entries */
219 #define	L_FCIOGETMAP_INVLD_LEN		0x20206
220 
221 /* FCIO_FORCE_LIP ioctl failed. */
222 #define	L_FCIO_FORCE_LIP_FAIL		0x20207
223 
224 /* Error definitions for FC devices */
225 /* FCIO_RESET_LINK ioctl failed */
226 #define	L_FCIO_RESET_LINK_FAIL		0x20208
227 
228 /* FCIO_GET_FCODE_REV_FAIL ioctl failed */
229 #define	L_FCIO_GET_FCODE_REV_FAIL	0x20209
230 
231 /* FCIO_GET_FW_REV_FAIL ioctl failed */
232 #define	L_FCIO_GET_FW_REV_FAIL		0x20210
233 
234 /* FCIO_GET_DEV_LIST returns invalid dev. counts */
235 #define	L_INVALID_DEVICE_COUNT		0x20211
236 
237 /* L_FCIO_GET_NUM_DEVS_FAIL ioctl failed */
238 #define	L_FCIO_GET_NUM_DEVS_FAIL	0x20212
239 
240 /* L_FCIO_GET_DEV_LIST_FAIL ioctl failed */
241 #define	L_FCIO_GET_DEV_LIST_FAIL	0x20213
242 
243 /* L_FCIO_GET_LINK_STATUS ioctl failed */
244 #define	L_FCIO_GET_LINK_STATUS_FAIL	0x20214
245 
246 /* L_FCIO_LOOPBACK_INTERNAL or FCIO_CMD/FCIO_LASER_OFF ioctl failed */
247 #define	L_PORT_OFFLINE_FAIL		0x20215
248 
249 /* Internal Loopback or laser off ioctls not supported */
250 #define	L_PORT_OFFLINE_UNSUPPORTED	0x20216
251 
252 /* L_FCIO_NO_LOOPBACK or FCIO_CMD/FCIO_LASER_ON ioctl failed */
253 #define	L_PORT_ONLINE_FAIL		0x20217
254 
255 /* No-Loopback or laser on ioctls not supported */
256 #define	L_PORT_ONLINE_UNSUPPORTED	0x20218
257 
258 /* L_FCIO_GET_HOST_PARAMS ioctl failed */
259 #define	L_FCIO_GET_HOST_PARAMS_FAIL	0x20219
260 
261 /* Loopback mode failure */
262 #define	L_LOOPBACK_FAILED		0x20220
263 
264 /* Loopback unsupported */
265 #define	L_LOOPBACK_UNSUPPORTED		0x20221
266 
267 /* FCIO_FORCE_LIP ioctl failed on one of the paths, say, of an MPXIO device */
268 #define	L_FCIO_FORCE_LIP_PARTIAL_FAIL	0x20222
269 
270 /*
271  * Error definitions
272  * for Fabric FC driver ioctls
273  */
274 /* FCP_TGT_INQUIRY ioctl failed */
275 #define	L_FCP_TGT_INQUIRY_FAIL		0x20250
276 
277 /*
278  * Error definitions
279  * for 24-bit address handling
280  */
281 /* Private loop address > 0xFF found */
282 #define	L_INVALID_PRIVATE_LOOP_ADDRESS	0x20401
283 
284 /* Encountered an unexpected fibre channel topology value */
285 #define	L_UNEXPECTED_FC_TOPOLOGY	0x20402
286 
287 /* Fabric address was not found */
288 #define	L_NO_FABRIC_ADDR_FOUND		0x20403
289 
290 /* The FCIO_GET_TOPOLOGY ioctl failed */
291 #define	L_FCIO_GET_TOPOLOGY_FAIL	0x20404
292 
293 /* Invalid fabric or public loop address */
294 #define	L_INVALID_FABRIC_ADDRESS	0x20405
295 
296 /* Point to Point fibre channel topology not supported */
297 #define	L_PT_PT_FC_TOP_NOT_SUPPORTED	0x20406
298 
299 /*
300  * Error definitions for Tapestry SAN support.
301  */
302 /* The FCIO_DEV_LOGIN ioctl failed */
303 #define	L_FCIO_DEV_LOGIN_FAIL		0x20407
304 
305 /* The FCIO_DEV_LOGOUT ioctl failed */
306 #define	L_FCIO_DEV_LOGOUT_FAIL		0x20408
307 
308 /* Operation not supported on connected topology */
309 #define	L_OPNOSUPP_ON_TOPOLOGY		0x20409
310 
311 /* Operation not supported on the path */
312 #define	L_INVALID_PATH_TYPE		0x20410
313 
314 /* FCIO_GET_STATE ioctl failed */
315 #define	L_FCIO_GET_STATE_FAIL		0x20411
316 
317 /* input WWN not found in dev list */
318 #define	L_WWN_NOT_FOUND_IN_DEV_LIST	0x20412
319 
320 /*
321  * Error definitions for
322  * g_dev_map_init related routines.
323  */
324 /* input addr invalid */
325 #define	L_INVALID_MAP_DEV_ADDR		0x20430
326 
327 /* input property invalid */
328 #define	L_INVALID_MAP_DEV_PROP_NAME	0x20431
329 
330 /* input property invalid */
331 #define	L_INVALID_MAP_DEV_PROP_TYPE	0x20432
332 
333 /* input property name invalid */
334 #define	L_INVALID_MAP_DEV_PROP		0x20433
335 
336 /* device not found */
337 #define	L_NO_SUCH_DEV_FOUND		0x20434
338 
339 /* prop not found */
340 #define	L_NO_SUCH_PROP_FOUND		0x20435
341 
342 /* invalid arg found */
343 #define	L_INVALID_ARG			0x20436
344 
345 /*
346  * Error definitions
347  * for Downloading IB FW.
348  */
349 /* Invalid download file checksum */
350 #define	L_DWNLD_CHKSUM_FAILED		0x20301
351 
352 /* Unable to read download exec header */
353 #define	L_DWNLD_READ_HEADER_FAIL	0x20302
354 
355 /* Number of bytes read from download file is not correct */
356 #define	L_DWNLD_READ_INCORRECT_BYTES	0x20303
357 
358 /* Wrong text segment size */
359 #define	L_DWNLD_INVALID_TEXT_SIZE	0x20304
360 
361 /* Error reading the download file */
362 #define	L_DWNLD_READ_ERROR		0x20305
363 
364 /* Bad firmware magic found in the download file */
365 #define	L_DWNLD_BAD_FRMWARE		0x20306
366 
367 /* Timeout message for the IB to be available */
368 #define	L_DWNLD_TIMED_OUT		0x20307
369 
370 /* Error with Rec Diag page 1 */
371 #define	L_REC_DIAG_PG1			0x20600
372 
373 /* Invalid transfer Length */
374 #define	L_TRANSFER_LEN			0x20601
375 
376 /* A firmware file must be specified on the command line */
377 #define	L_REQUIRE_FILE			0x20602
378 
379 
380 /*
381  * Error definitions
382  * for System Errors
383  */
384 #define	L_MALLOC_FAILED			0x30000
385 
386 #define	L_MEMCPY_FAILED			0x30001
387 
388 /* Cannot get status for the given path */
389 #define	L_LSTAT_ERROR			0x30020
390 
391 /* Error reading the symbolic link */
392 #define	L_SYMLINK_ERROR			0x30021
393 
394 /* Could not convert std. time to hrs/min/sec */
395 #define	L_LOCALTIME_ERROR		0x30022
396 
397 /* select() system call failed to wait for specified time */
398 #define	L_SELECT_ERROR			0x30023
399 
400 /* uname() system call failed to get the system info. */
401 #define	L_UNAME_FAILED			0x30024
402 
403 /* Cannot get status for the given path */
404 #define	L_FSTAT_ERROR			0x30025
405 
406 /* Cannot get status for the given path */
407 #define	L_STAT_ERROR			0x30026
408 
409 /* di_init() failed to return snapshot of device tree */
410 #define	L_DEV_SNAPSHOT_FAILED		0x30027
411 
412 /* di_drv_first_node() failed to find a valid driver */
413 #define	L_PORT_DRIVER_NOT_FOUND		0x30029
414 
415 /* failed to find any device paths */
416 #define	L_PHYS_PATH_NOT_FOUND		0x30030
417 
418 /* No device identifier found  */
419 #define	L_NO_DEVID			0x30031
420 
421 /* Driver not supported */
422 #define	L_DRIVER_NOTSUPP		0x30032
423 
424 /* di_prom_init failure */
425 #define	L_PROM_INIT_FAILED		0x30033
426 
427 /*
428  * Error definitions
429  * for individual
430  * devices.
431  */
432 /* Device busy */
433 #define	L_DEV_BUSY			0x40000
434 
435 /* Disk reserved */
436 #define	L_DEVICE_RESERVED		0x40001
437 
438 /* One or more disks in enclosure are reserved */
439 #define	L_DISKS_RESERVED		0x40002
440 
441 /* Exclusive open to a device failed. May be busy */
442 #define	L_EXCL_OPEN_FAILED		0x40003
443 
444 /* Empty slot: Device not installed */
445 #define	L_SLOT_EMPTY			0x40100
446 
447 
448 /*
449  * Error definitions
450  * for Devctl functions.
451  */
452 /* Devctl acquire fails */
453 #define	L_ACQUIRE_FAIL			0x40200
454 
455 
456 /* Power off fails. Device may be busy */
457 #define	L_POWER_OFF_FAIL_BUSY		0x40300
458 
459 
460 /*
461  * Error definitions
462  * specific to Enclosure.
463  */
464 /* Failed to change the enclosure name */
465 #define	L_ENCL_NAME_CHANGE_FAIL		0x40400
466 
467 /* Duplicate enclosure names found */
468 #define	L_DUPLICATE_ENCLOSURES		0x40401
469 
470 /* Invalid no. of dsks in SENA enclosure */
471 #define	L_INVALID_NUM_DISKS_ENCL	0x40402
472 
473 /* Path is not to a SENA ecnlosure. */
474 #define	L_ENCL_INVALID_PATH		0x40403
475 
476 /* Cannot get the box list */
477 #define	L_NO_ENCL_LIST_FOUND		0x40404
478 
479 
480 /*
481  * Error definitions
482  * specific to IB.
483  */
484 /* No element returned from the enclosure */
485 #define	L_IB_NO_ELEM_FOUND		0x40500
486 
487 /* Invalid page code found in Receive Diag. page.   */
488 #define	L_RD_PG_INVLD_CODE		0x40501
489 
490 /* Reading Receive Diag. page failed: small buffer. */
491 #define	L_RD_PG_MIN_BUFF		0x40502
492 
493 /* Get status failed    */
494 #define	L_GET_STATUS_FAILED		0x40600
495 
496 /* Warning define. */
497 #define	L_WARNING			0x90000
498 
499 /*
500  * For i18n
501  */
502 #include <nl_types.h>
503 extern nl_catd l_catd;
504 #define	L_SET1				1	/* catalog set number */
505 #define	MSGSTR(Num, Str)	catgets(l_catd, L_SET1, Num, Str)
506 
507 
508 #ifdef	__cplusplus
509 }
510 #endif
511 
512 #endif	/* _STGCOM_H */
513