xref: /titanic_52/usr/src/uts/common/sys/scsi/targets/sesio.h (revision 24f1a99ad671ad2e77a8c7e955e71b296de4a639)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*24f1a99aSjmcp  * Common Development and Distribution License (the "License").
6*24f1a99aSjmcp  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*24f1a99aSjmcp  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_SYS_SESIO_H
277c478bd9Sstevel@tonic-gate #define	_SYS_SESIO_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate /*
327c478bd9Sstevel@tonic-gate  * Enclosure Services Interface Structures
337c478bd9Sstevel@tonic-gate  */
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
367c478bd9Sstevel@tonic-gate extern "C" {
377c478bd9Sstevel@tonic-gate #endif
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate /*
407c478bd9Sstevel@tonic-gate  * Data Structures and definitions for SES Applications
417c478bd9Sstevel@tonic-gate  */
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate typedef struct {
447c478bd9Sstevel@tonic-gate 	unsigned int obj_id;		/* Object Identifier */
457c478bd9Sstevel@tonic-gate 	unsigned int		:  16,	/* reserved */
467c478bd9Sstevel@tonic-gate 		subencid	:  8,	/* SubEnclosure ID */
477c478bd9Sstevel@tonic-gate 		elem_type	:  8;	/* Element Type */
487c478bd9Sstevel@tonic-gate } ses_object;
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate /* Known Enclosure Types */
517c478bd9Sstevel@tonic-gate #define	SESTYP_UNSPECIFIED	0x00
527c478bd9Sstevel@tonic-gate #define	SESTYP_DEVICE		0x01
537c478bd9Sstevel@tonic-gate #define	SESTYP_POWER		0x02
547c478bd9Sstevel@tonic-gate #define	SESTYP_FAN		0x03
557c478bd9Sstevel@tonic-gate #define	SESTYP_THERM		0x04
567c478bd9Sstevel@tonic-gate #define	SESTYP_DOORLOCK		0x05
577c478bd9Sstevel@tonic-gate #define	SESTYP_ALARM		0x06
587c478bd9Sstevel@tonic-gate #define	SESTYP_ESCC		0x07	/* Enclosure SCC */
597c478bd9Sstevel@tonic-gate #define	SESTYP_SCC		0x08	/* SCC */
607c478bd9Sstevel@tonic-gate #define	SESTYP_NVRAM		0x09
617c478bd9Sstevel@tonic-gate #define	SESTYP_UPS		0x0b
627c478bd9Sstevel@tonic-gate #define	SESTYP_DISPLAY		0x0c
637c478bd9Sstevel@tonic-gate #define	SESTYP_KEYPAD		0x0d
647c478bd9Sstevel@tonic-gate #define	SESTYP_SCSIXVR		0x0f
657c478bd9Sstevel@tonic-gate #define	SESTYP_LANGUAGE		0x10
667c478bd9Sstevel@tonic-gate #define	SESTYP_COMPORT		0x11
677c478bd9Sstevel@tonic-gate #define	SESTYP_VOM		0x12
687c478bd9Sstevel@tonic-gate #define	SESTYP_AMMETER		0x13
697c478bd9Sstevel@tonic-gate #define	SESTYP_SCSI_TGT		0x14
707c478bd9Sstevel@tonic-gate #define	SESTYP_SCSI_INI		0x15
717c478bd9Sstevel@tonic-gate #define	SESTYP_SUBENC		0x16
72*24f1a99aSjmcp #define	SESTYP_ARRAY		0x17	/* SES2r19 #7.1 */
73*24f1a99aSjmcp #define	SESTYP_SASEXPANDER	0x18	/* SES2r19 #7.1 */
74*24f1a99aSjmcp #define	SESTYP_SASCONNECTOR	0x19	/* SES2r19 #7.1 */
75*24f1a99aSjmcp 
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate /*
787c478bd9Sstevel@tonic-gate  * Overall Enclosure Status
797c478bd9Sstevel@tonic-gate  */
807c478bd9Sstevel@tonic-gate #define	ENCSTAT_UNRECOV		0x1
817c478bd9Sstevel@tonic-gate #define	ENCSTAT_CRITICAL	0x2
827c478bd9Sstevel@tonic-gate #define	ENCSTAT_NONCRITICAL	0x4
837c478bd9Sstevel@tonic-gate #define	ENCSTAT_INFO		0x8
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate typedef struct {
867c478bd9Sstevel@tonic-gate 	uint_t obj_id;
877c478bd9Sstevel@tonic-gate 	uchar_t cstat[4];
887c478bd9Sstevel@tonic-gate } ses_objarg;
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate /* Summary SES Status Defines, Common Status Codes */
917c478bd9Sstevel@tonic-gate #define	SESSTAT_UNSUPPORTED	0
927c478bd9Sstevel@tonic-gate #define	SESSTAT_OK		1
937c478bd9Sstevel@tonic-gate #define	SESSTAT_CRIT		2
947c478bd9Sstevel@tonic-gate #define	SESSTAT_NONCRIT		3
957c478bd9Sstevel@tonic-gate #define	SESSTAT_UNRECOV		4
967c478bd9Sstevel@tonic-gate #define	SESSTAT_NOTINSTALLED	5
977c478bd9Sstevel@tonic-gate #define	SESSTAT_UNKNOWN		6
987c478bd9Sstevel@tonic-gate #define	SESSTAT_NOTAVAIL	7
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate /*
1017c478bd9Sstevel@tonic-gate  * For control pages, cstat[0] is the same for the
1027c478bd9Sstevel@tonic-gate  * enclosure and is common across all device types.
1037c478bd9Sstevel@tonic-gate  *
1047c478bd9Sstevel@tonic-gate  * If SESCTL_CSEL is set, then PRDFAIL, DISABLE and RSTSWAP
1057c478bd9Sstevel@tonic-gate  * are checked, otherwise bits that are specific to the device
1067c478bd9Sstevel@tonic-gate  * type in the other 3 bytes of cstat or checked.
1077c478bd9Sstevel@tonic-gate  */
1087c478bd9Sstevel@tonic-gate #define	SESCTL_CSEL		0x80
1097c478bd9Sstevel@tonic-gate #define	SESCTL_PRDFAIL		0x40
1107c478bd9Sstevel@tonic-gate #define	SESCTL_DISABLE		0x20
1117c478bd9Sstevel@tonic-gate #define	SESCTL_RSTSWAP		0x10
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate /* Control bits, Device Elements, byte 2 */
1157c478bd9Sstevel@tonic-gate #define	SESCTL_DRVLCK	0x40	/* "DO NOT REMOVE" */
1167c478bd9Sstevel@tonic-gate #define	SESCTL_RQSINS	0x08	/* RQST INSERT */
1177c478bd9Sstevel@tonic-gate #define	SESCTL_RQSRMV	0x04	/* RQST REMOVE */
1187c478bd9Sstevel@tonic-gate #define	SESCTL_RQSID	0x02	/* RQST IDENT */
1197c478bd9Sstevel@tonic-gate /* Control bits, Device Elements, byte 3 */
1207c478bd9Sstevel@tonic-gate #define	SESCTL_RQSFLT	0x20	/* RQST FAULT */
1217c478bd9Sstevel@tonic-gate #define	SESCTL_DEVOFF	0x10	/* DEVICE OFF */
1227c478bd9Sstevel@tonic-gate 
1237c478bd9Sstevel@tonic-gate /* Control bits, Generic, byte 3 */
1247c478bd9Sstevel@tonic-gate #define	SESCTL_RQSTFAIL	0x40
1257c478bd9Sstevel@tonic-gate #define	SESCTL_RQSTON	0x20
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate /*
1297c478bd9Sstevel@tonic-gate  * SES Driver ioctls
1307c478bd9Sstevel@tonic-gate  */
1317c478bd9Sstevel@tonic-gate #define	SESIOC			('e'<<8)
1327c478bd9Sstevel@tonic-gate #define	SESIOC_IOCTL_GETSTATE	(SESIOC|1)	/* get esi status */
1337c478bd9Sstevel@tonic-gate #define	SESIOC_IOCTL_SETSTATE	(SESIOC|2)	/* set esi state */
1347c478bd9Sstevel@tonic-gate #define	SESIOC_IOCTL_INQUIRY	(SESIOC|3)	/* get SCSI Inquiry info */
1357c478bd9Sstevel@tonic-gate #define	SESIOC_GETNOBJ		(SESIOC|10)
1367c478bd9Sstevel@tonic-gate #define	SESIOC_GETOBJMAP	(SESIOC|11)
1377c478bd9Sstevel@tonic-gate #define	SESIOC_INIT		(SESIOC|12)
1387c478bd9Sstevel@tonic-gate #define	SESIOC_GETENCSTAT	(SESIOC|13)
1397c478bd9Sstevel@tonic-gate #define	SESIOC_SETENCSTAT	(SESIOC|14)
1407c478bd9Sstevel@tonic-gate #define	SESIOC_GETOBJSTAT	(SESIOC|15)
1417c478bd9Sstevel@tonic-gate #define	SESIOC_SETOBJSTAT	(SESIOC|16)
1427c478bd9Sstevel@tonic-gate 
1437c478bd9Sstevel@tonic-gate /*
1447c478bd9Sstevel@tonic-gate  * The following structure is used by the SES_IOCTL_GETSTATE
1457c478bd9Sstevel@tonic-gate  * and the SES_IOCTL_SETSTATE ioctls
1467c478bd9Sstevel@tonic-gate  */
1477c478bd9Sstevel@tonic-gate struct ses_ioctl {
1487c478bd9Sstevel@tonic-gate     uint32_t	page_size;	/* Size of page to be read/written */
1497c478bd9Sstevel@tonic-gate     uint8_t	page_code;	/* Page to be read/written */
1507c478bd9Sstevel@tonic-gate     caddr_t	page;		/* Address of page to be read/written */
1517c478bd9Sstevel@tonic-gate };
1527c478bd9Sstevel@tonic-gate 
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1557c478bd9Sstevel@tonic-gate }
1567c478bd9Sstevel@tonic-gate #endif
1577c478bd9Sstevel@tonic-gate 
1587c478bd9Sstevel@tonic-gate #endif	/* _SYS_SESIO_H */
159