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