xref: /titanic_44/usr/src/uts/common/sys/scsi/targets/sesio.h (revision 8eea8e29cc4374d1ee24c25a07f45af132db3499)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_SESIO_H
28 #define	_SYS_SESIO_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * Enclosure Services Interface Structures
34  */
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 /*
41  * Data Structures and definitions for SES Applications
42  */
43 
44 typedef struct {
45 	unsigned int obj_id;		/* Object Identifier */
46 	unsigned int		:  16,	/* reserved */
47 		subencid	:  8,	/* SubEnclosure ID */
48 		elem_type	:  8;	/* Element Type */
49 } ses_object;
50 
51 /* Known Enclosure Types */
52 #define	SESTYP_UNSPECIFIED	0x00
53 #define	SESTYP_DEVICE		0x01
54 #define	SESTYP_POWER		0x02
55 #define	SESTYP_FAN		0x03
56 #define	SESTYP_THERM		0x04
57 #define	SESTYP_DOORLOCK		0x05
58 #define	SESTYP_ALARM		0x06
59 #define	SESTYP_ESCC		0x07	/* Enclosure SCC */
60 #define	SESTYP_SCC		0x08	/* SCC */
61 #define	SESTYP_NVRAM		0x09
62 #define	SESTYP_UPS		0x0b
63 #define	SESTYP_DISPLAY		0x0c
64 #define	SESTYP_KEYPAD		0x0d
65 #define	SESTYP_SCSIXVR		0x0f
66 #define	SESTYP_LANGUAGE		0x10
67 #define	SESTYP_COMPORT		0x11
68 #define	SESTYP_VOM		0x12
69 #define	SESTYP_AMMETER		0x13
70 #define	SESTYP_SCSI_TGT		0x14
71 #define	SESTYP_SCSI_INI		0x15
72 #define	SESTYP_SUBENC		0x16
73 
74 /*
75  * Overall Enclosure Status
76  */
77 #define	ENCSTAT_UNRECOV		0x1
78 #define	ENCSTAT_CRITICAL	0x2
79 #define	ENCSTAT_NONCRITICAL	0x4
80 #define	ENCSTAT_INFO		0x8
81 
82 typedef struct {
83 	uint_t obj_id;
84 	uchar_t cstat[4];
85 } ses_objarg;
86 
87 /* Summary SES Status Defines, Common Status Codes */
88 #define	SESSTAT_UNSUPPORTED	0
89 #define	SESSTAT_OK		1
90 #define	SESSTAT_CRIT		2
91 #define	SESSTAT_NONCRIT		3
92 #define	SESSTAT_UNRECOV		4
93 #define	SESSTAT_NOTINSTALLED	5
94 #define	SESSTAT_UNKNOWN		6
95 #define	SESSTAT_NOTAVAIL	7
96 
97 /*
98  * For control pages, cstat[0] is the same for the
99  * enclosure and is common across all device types.
100  *
101  * If SESCTL_CSEL is set, then PRDFAIL, DISABLE and RSTSWAP
102  * are checked, otherwise bits that are specific to the device
103  * type in the other 3 bytes of cstat or checked.
104  */
105 #define	SESCTL_CSEL		0x80
106 #define	SESCTL_PRDFAIL		0x40
107 #define	SESCTL_DISABLE		0x20
108 #define	SESCTL_RSTSWAP		0x10
109 
110 
111 /* Control bits, Device Elements, byte 2 */
112 #define	SESCTL_DRVLCK	0x40	/* "DO NOT REMOVE" */
113 #define	SESCTL_RQSINS	0x08	/* RQST INSERT */
114 #define	SESCTL_RQSRMV	0x04	/* RQST REMOVE */
115 #define	SESCTL_RQSID	0x02	/* RQST IDENT */
116 /* Control bits, Device Elements, byte 3 */
117 #define	SESCTL_RQSFLT	0x20	/* RQST FAULT */
118 #define	SESCTL_DEVOFF	0x10	/* DEVICE OFF */
119 
120 /* Control bits, Generic, byte 3 */
121 #define	SESCTL_RQSTFAIL	0x40
122 #define	SESCTL_RQSTON	0x20
123 
124 
125 /*
126  * SES Driver ioctls
127  */
128 #define	SESIOC			('e'<<8)
129 #define	SESIOC_IOCTL_GETSTATE	(SESIOC|1)	/* get esi status */
130 #define	SESIOC_IOCTL_SETSTATE	(SESIOC|2)	/* set esi state */
131 #define	SESIOC_IOCTL_INQUIRY	(SESIOC|3)	/* get SCSI Inquiry info */
132 #define	SESIOC_GETNOBJ		(SESIOC|10)
133 #define	SESIOC_GETOBJMAP	(SESIOC|11)
134 #define	SESIOC_INIT		(SESIOC|12)
135 #define	SESIOC_GETENCSTAT	(SESIOC|13)
136 #define	SESIOC_SETENCSTAT	(SESIOC|14)
137 #define	SESIOC_GETOBJSTAT	(SESIOC|15)
138 #define	SESIOC_SETOBJSTAT	(SESIOC|16)
139 
140 /*
141  * The following structure is used by the SES_IOCTL_GETSTATE
142  * and the SES_IOCTL_SETSTATE ioctls
143  */
144 struct ses_ioctl {
145     uint32_t	page_size;	/* Size of page to be read/written */
146     uint8_t	page_code;	/* Page to be read/written */
147     caddr_t	page;		/* Address of page to be read/written */
148 };
149 
150 
151 #ifdef	__cplusplus
152 }
153 #endif
154 
155 #endif	/* _SYS_SESIO_H */
156