3 * Copyright (c) 2000 by Matthew Jacob
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions, and the following disclaimer,
11 * without modification, immediately at the beginning of the file.
12 * 2. The name of the author may not be used to endorse or promote products
13 * derived from this software without specific prior written permission.
15 * Alternatively, this software may be distributed under the terms of the
16 * the GNU Public License ("GPL").
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
22 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 #define SESIOC ('s' - 040)
33 #define SESIOC_GETNOBJ _IO(SESIOC, 1)
34 #define SESIOC_GETOBJMAP _IO(SESIOC, 2)
35 #define SESIOC_GETENCSTAT _IO(SESIOC, 3)
36 #define SESIOC_SETENCSTAT _IO(SESIOC, 4)
37 #define SESIOC_GETOBJSTAT _IO(SESIOC, 5)
38 #define SESIOC_SETOBJSTAT _IO(SESIOC, 6)
39 #define SESIOC_GETTEXT _IO(SESIOC, 7)
40 #define SESIOC_INIT _IO(SESIOC, 8)
43 * Platform Independent Definitions for SES devices.
46 * SCSI Based Environmental Services Application Defines
48 * Based almost entirely on SCSI-3 SES Revision 8A specification,
49 * but slightly abstracted as the underlying device may in fact
50 * be a SAF-TE or vendor unique device.
53 * SES Driver Operations:
54 * (The defines themselves are platform and access method specific)
65 * An application finds out how many objects an SES instance
66 * is managing by performing a SESIOC_GETNOBJ operation. It then
67 * performs a SESIOC_GETOBJMAP to get the map that contains the
68 * object identifiers for all objects (see ses_object below).
69 * This information is static.
71 * The application may perform SESIOC_GETOBJSTAT operations to retrieve
72 * status on an object (see the ses_objstat structure below), SESIOC_SETOBJSTAT
73 * operations to set status for an object.
75 * Similarly overall enclosure status me be fetched or set via
76 * SESIOC_GETENCSTAT or SESIOC_SETENCSTAT operations (see ses_encstat below).
78 * Readers should note that there is nothing that requires either a set
79 * or a clear operation to actually latch and do anything in the target.
81 * A SESIOC_INIT operation causes the enclosure to be initialized.
85 unsigned int obj_id; /* Object Identifier */
86 unsigned char subencid; /* SubEnclosure ID */
87 unsigned char object_type; /* Object Type */
91 #define SESTYP_UNSPECIFIED 0x00
92 #define SESTYP_DEVICE 0x01
93 #define SESTYP_POWER 0x02
94 #define SESTYP_FAN 0x03
95 #define SESTYP_THERM 0x04
96 #define SESTYP_DOORLOCK 0x05
97 #define SESTYP_ALARM 0x06
98 #define SESTYP_ESCC 0x07 /* Enclosure SCC */
99 #define SESTYP_SCC 0x08 /* SCC */
100 #define SESTYP_NVRAM 0x09
101 #define SESTYP_UPS 0x0b
102 #define SESTYP_DISPLAY 0x0c
103 #define SESTYP_KEYPAD 0x0d
104 #define SESTYP_SCSIXVR 0x0f
105 #define SESTYP_LANGUAGE 0x10
106 #define SESTYP_COMPORT 0x11
107 #define SESTYP_VOM 0x12
108 #define SESTYP_AMMETER 0x13
109 #define SESTYP_SCSI_TGT 0x14
110 #define SESTYP_SCSI_INI 0x15
111 #define SESTYP_SUBENC 0x16
114 * Overall Enclosure Status
116 typedef unsigned char ses_encstat;
117 #define SES_ENCSTAT_UNRECOV 0x1
118 #define SES_ENCSTAT_CRITICAL 0x2
119 #define SES_ENCSTAT_NONCRITICAL 0x4
120 #define SES_ENCSTAT_INFO 0x8
127 unsigned char cstat[4];
130 /* Summary SES Status Defines, Common Status Codes */
131 #define SES_OBJSTAT_UNSUPPORTED 0
132 #define SES_OBJSTAT_OK 1
133 #define SES_OBJSTAT_CRIT 2
134 #define SES_OBJSTAT_NONCRIT 3
135 #define SES_OBJSTAT_UNRECOV 4
136 #define SES_OBJSTAT_NOTINSTALLED 5
137 #define SES_OBJSTAT_UNKNOWN 6
138 #define SES_OBJSTAT_NOTAVAIL 7
141 * For control pages, cstat[0] is the same for the
142 * enclosure and is common across all device types.
144 * If SESCTL_CSEL is set, then PRDFAIL, DISABLE and RSTSWAP
145 * are checked, otherwise bits that are specific to the device
146 * type in the other 3 bytes of cstat or checked.
148 #define SESCTL_CSEL 0x80
149 #define SESCTL_PRDFAIL 0x40
150 #define SESCTL_DISABLE 0x20
151 #define SESCTL_RSTSWAP 0x10
154 /* Control bits, Device Elements, byte 2 */
155 #define SESCTL_DRVLCK 0x40 /* "DO NOT REMOVE" */
156 #define SESCTL_RQSINS 0x08 /* RQST INSERT */
157 #define SESCTL_RQSRMV 0x04 /* RQST REMOVE */
158 #define SESCTL_RQSID 0x02 /* RQST IDENT */
159 /* Control bits, Device Elements, byte 3 */
160 #define SESCTL_RQSFLT 0x20 /* RQST FAULT */
161 #define SESCTL_DEVOFF 0x10 /* DEVICE OFF */
163 /* Control bits, Generic, byte 3 */
164 #define SESCTL_RQSTFAIL 0x40
165 #define SESCTL_RQSTON 0x20
168 * Getting text for an object type is a little
169 * trickier because it's string data that can
170 * go up to 64 KBytes. Build this union and
171 * fill the obj_id with the id of the object who's
172 * help text you want, and if text is available,
173 * obj_text will be filled in, null terminated.