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