xref: /onnv-gate/usr/src/uts/common/sys/scsi/targets/sesio.h (revision 6948:28788c8a03a8)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*6948Sjmcp  * Common Development and Distribution License (the "License").
6*6948Sjmcp  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*6948Sjmcp  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_SESIO_H
270Sstevel@tonic-gate #define	_SYS_SESIO_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate /*
320Sstevel@tonic-gate  * Enclosure Services Interface Structures
330Sstevel@tonic-gate  */
340Sstevel@tonic-gate 
350Sstevel@tonic-gate #ifdef	__cplusplus
360Sstevel@tonic-gate extern "C" {
370Sstevel@tonic-gate #endif
380Sstevel@tonic-gate 
390Sstevel@tonic-gate /*
400Sstevel@tonic-gate  * Data Structures and definitions for SES Applications
410Sstevel@tonic-gate  */
420Sstevel@tonic-gate 
430Sstevel@tonic-gate typedef struct {
440Sstevel@tonic-gate 	unsigned int obj_id;		/* Object Identifier */
450Sstevel@tonic-gate 	unsigned int		:  16,	/* reserved */
460Sstevel@tonic-gate 		subencid	:  8,	/* SubEnclosure ID */
470Sstevel@tonic-gate 		elem_type	:  8;	/* Element Type */
480Sstevel@tonic-gate } ses_object;
490Sstevel@tonic-gate 
500Sstevel@tonic-gate /* Known Enclosure Types */
510Sstevel@tonic-gate #define	SESTYP_UNSPECIFIED	0x00
520Sstevel@tonic-gate #define	SESTYP_DEVICE		0x01
530Sstevel@tonic-gate #define	SESTYP_POWER		0x02
540Sstevel@tonic-gate #define	SESTYP_FAN		0x03
550Sstevel@tonic-gate #define	SESTYP_THERM		0x04
560Sstevel@tonic-gate #define	SESTYP_DOORLOCK		0x05
570Sstevel@tonic-gate #define	SESTYP_ALARM		0x06
580Sstevel@tonic-gate #define	SESTYP_ESCC		0x07	/* Enclosure SCC */
590Sstevel@tonic-gate #define	SESTYP_SCC		0x08	/* SCC */
600Sstevel@tonic-gate #define	SESTYP_NVRAM		0x09
610Sstevel@tonic-gate #define	SESTYP_UPS		0x0b
620Sstevel@tonic-gate #define	SESTYP_DISPLAY		0x0c
630Sstevel@tonic-gate #define	SESTYP_KEYPAD		0x0d
640Sstevel@tonic-gate #define	SESTYP_SCSIXVR		0x0f
650Sstevel@tonic-gate #define	SESTYP_LANGUAGE		0x10
660Sstevel@tonic-gate #define	SESTYP_COMPORT		0x11
670Sstevel@tonic-gate #define	SESTYP_VOM		0x12
680Sstevel@tonic-gate #define	SESTYP_AMMETER		0x13
690Sstevel@tonic-gate #define	SESTYP_SCSI_TGT		0x14
700Sstevel@tonic-gate #define	SESTYP_SCSI_INI		0x15
710Sstevel@tonic-gate #define	SESTYP_SUBENC		0x16
72*6948Sjmcp #define	SESTYP_ARRAY		0x17	/* SES2r19 #7.1 */
73*6948Sjmcp #define	SESTYP_SASEXPANDER	0x18	/* SES2r19 #7.1 */
74*6948Sjmcp #define	SESTYP_SASCONNECTOR	0x19	/* SES2r19 #7.1 */
75*6948Sjmcp 
760Sstevel@tonic-gate 
770Sstevel@tonic-gate /*
780Sstevel@tonic-gate  * Overall Enclosure Status
790Sstevel@tonic-gate  */
800Sstevel@tonic-gate #define	ENCSTAT_UNRECOV		0x1
810Sstevel@tonic-gate #define	ENCSTAT_CRITICAL	0x2
820Sstevel@tonic-gate #define	ENCSTAT_NONCRITICAL	0x4
830Sstevel@tonic-gate #define	ENCSTAT_INFO		0x8
840Sstevel@tonic-gate 
850Sstevel@tonic-gate typedef struct {
860Sstevel@tonic-gate 	uint_t obj_id;
870Sstevel@tonic-gate 	uchar_t cstat[4];
880Sstevel@tonic-gate } ses_objarg;
890Sstevel@tonic-gate 
900Sstevel@tonic-gate /* Summary SES Status Defines, Common Status Codes */
910Sstevel@tonic-gate #define	SESSTAT_UNSUPPORTED	0
920Sstevel@tonic-gate #define	SESSTAT_OK		1
930Sstevel@tonic-gate #define	SESSTAT_CRIT		2
940Sstevel@tonic-gate #define	SESSTAT_NONCRIT		3
950Sstevel@tonic-gate #define	SESSTAT_UNRECOV		4
960Sstevel@tonic-gate #define	SESSTAT_NOTINSTALLED	5
970Sstevel@tonic-gate #define	SESSTAT_UNKNOWN		6
980Sstevel@tonic-gate #define	SESSTAT_NOTAVAIL	7
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate /*
1010Sstevel@tonic-gate  * For control pages, cstat[0] is the same for the
1020Sstevel@tonic-gate  * enclosure and is common across all device types.
1030Sstevel@tonic-gate  *
1040Sstevel@tonic-gate  * If SESCTL_CSEL is set, then PRDFAIL, DISABLE and RSTSWAP
1050Sstevel@tonic-gate  * are checked, otherwise bits that are specific to the device
1060Sstevel@tonic-gate  * type in the other 3 bytes of cstat or checked.
1070Sstevel@tonic-gate  */
1080Sstevel@tonic-gate #define	SESCTL_CSEL		0x80
1090Sstevel@tonic-gate #define	SESCTL_PRDFAIL		0x40
1100Sstevel@tonic-gate #define	SESCTL_DISABLE		0x20
1110Sstevel@tonic-gate #define	SESCTL_RSTSWAP		0x10
1120Sstevel@tonic-gate 
1130Sstevel@tonic-gate 
1140Sstevel@tonic-gate /* Control bits, Device Elements, byte 2 */
1150Sstevel@tonic-gate #define	SESCTL_DRVLCK	0x40	/* "DO NOT REMOVE" */
1160Sstevel@tonic-gate #define	SESCTL_RQSINS	0x08	/* RQST INSERT */
1170Sstevel@tonic-gate #define	SESCTL_RQSRMV	0x04	/* RQST REMOVE */
1180Sstevel@tonic-gate #define	SESCTL_RQSID	0x02	/* RQST IDENT */
1190Sstevel@tonic-gate /* Control bits, Device Elements, byte 3 */
1200Sstevel@tonic-gate #define	SESCTL_RQSFLT	0x20	/* RQST FAULT */
1210Sstevel@tonic-gate #define	SESCTL_DEVOFF	0x10	/* DEVICE OFF */
1220Sstevel@tonic-gate 
1230Sstevel@tonic-gate /* Control bits, Generic, byte 3 */
1240Sstevel@tonic-gate #define	SESCTL_RQSTFAIL	0x40
1250Sstevel@tonic-gate #define	SESCTL_RQSTON	0x20
1260Sstevel@tonic-gate 
1270Sstevel@tonic-gate 
1280Sstevel@tonic-gate /*
1290Sstevel@tonic-gate  * SES Driver ioctls
1300Sstevel@tonic-gate  */
1310Sstevel@tonic-gate #define	SESIOC			('e'<<8)
1320Sstevel@tonic-gate #define	SESIOC_IOCTL_GETSTATE	(SESIOC|1)	/* get esi status */
1330Sstevel@tonic-gate #define	SESIOC_IOCTL_SETSTATE	(SESIOC|2)	/* set esi state */
1340Sstevel@tonic-gate #define	SESIOC_IOCTL_INQUIRY	(SESIOC|3)	/* get SCSI Inquiry info */
1350Sstevel@tonic-gate #define	SESIOC_GETNOBJ		(SESIOC|10)
1360Sstevel@tonic-gate #define	SESIOC_GETOBJMAP	(SESIOC|11)
1370Sstevel@tonic-gate #define	SESIOC_INIT		(SESIOC|12)
1380Sstevel@tonic-gate #define	SESIOC_GETENCSTAT	(SESIOC|13)
1390Sstevel@tonic-gate #define	SESIOC_SETENCSTAT	(SESIOC|14)
1400Sstevel@tonic-gate #define	SESIOC_GETOBJSTAT	(SESIOC|15)
1410Sstevel@tonic-gate #define	SESIOC_SETOBJSTAT	(SESIOC|16)
1420Sstevel@tonic-gate 
1430Sstevel@tonic-gate /*
1440Sstevel@tonic-gate  * The following structure is used by the SES_IOCTL_GETSTATE
1450Sstevel@tonic-gate  * and the SES_IOCTL_SETSTATE ioctls
1460Sstevel@tonic-gate  */
1470Sstevel@tonic-gate struct ses_ioctl {
1480Sstevel@tonic-gate     uint32_t	page_size;	/* Size of page to be read/written */
1490Sstevel@tonic-gate     uint8_t	page_code;	/* Page to be read/written */
1500Sstevel@tonic-gate     caddr_t	page;		/* Address of page to be read/written */
1510Sstevel@tonic-gate };
1520Sstevel@tonic-gate 
1530Sstevel@tonic-gate 
1540Sstevel@tonic-gate #ifdef	__cplusplus
1550Sstevel@tonic-gate }
1560Sstevel@tonic-gate #endif
1570Sstevel@tonic-gate 
1580Sstevel@tonic-gate #endif	/* _SYS_SESIO_H */
159