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
34 #include <cam/scsi/scsi_ses.h>
36 #define ENCIOC ('s' - 040)
37 #define ENCIOC_GETNELM _IO(ENCIOC, 1)
38 #define ENCIOC_GETELMMAP _IO(ENCIOC, 2)
39 #define ENCIOC_GETENCSTAT _IO(ENCIOC, 3)
40 #define ENCIOC_SETENCSTAT _IO(ENCIOC, 4)
41 #define ENCIOC_GETELMSTAT _IO(ENCIOC, 5)
42 #define ENCIOC_SETELMSTAT _IO(ENCIOC, 6)
43 #define ENCIOC_GETTEXT _IO(ENCIOC, 7)
44 #define ENCIOC_INIT _IO(ENCIOC, 8)
45 #define ENCIOC_GETELMDESC _IO(ENCIOC, 9)
46 #define ENCIOC_GETELMDEVNAMES _IO(ENCIOC, 10)
47 #define ENCIOC_GETSTRING _IO(ENCIOC, 11)
48 #define ENCIOC_SETSTRING _IO(ENCIOC, 12)
49 #define ENCIOC_GETENCNAME _IO(ENCIOC, 13)
50 #define ENCIOC_GETENCID _IO(ENCIOC, 14)
53 * Platform Independent Definitions for enclosure devices.
56 * SCSI Based Environmental Services Application Defines
58 * Based almost entirely on SCSI-3 ENC Revision 8A specification,
59 * but slightly abstracted as the underlying device may in fact
60 * be a SAF-TE or vendor unique device.
63 * ENC Driver Operations:
64 * (The defines themselves are platform and access method specific)
75 * An application finds out how many elements an enclosure instance
76 * is managing by performing a ENCIOC_GETNELM operation. It then
77 * performs a ENCIOC_GETELMMAP to get the map that contains the
78 * elment identifiers for all elements (see encioc_element_t below).
79 * This information is static.
81 * The application may perform ENCIOC_GETELMSTAT operations to retrieve
82 * status on an element (see the enc_elm_status_t structure below),
83 * ENCIOC_SETELMSTAT operations to set status for an element.
85 * Similarly, overall enclosure status me be fetched or set via
86 * ENCIOC_GETENCSTAT or ENCIOC_SETENCSTAT operations (see encioc_enc_status_t
89 * Readers should note that there is nothing that requires either a set
90 * or a clear operation to actually latch and do anything in the target.
92 * A ENCIOC_INIT operation causes the enclosure to be initialized.
97 ELMTYP_UNSPECIFIED = 0x00,
102 ELMTYP_DOORLOCK = 0x05,
104 ELMTYP_ESCC = 0x07, /* Enclosure SCC */
105 ELMTYP_SCC = 0x08, /* SCC */
107 ELMTYP_INV_OP_REASON = 0x0a,
109 ELMTYP_DISPLAY = 0x0c,
110 ELMTYP_KEYPAD = 0x0d,
111 ELMTYP_ENCLOSURE = 0x0e,
112 ELMTYP_SCSIXVR = 0x0f,
113 ELMTYP_LANGUAGE = 0x10,
114 ELMTYP_COMPORT = 0x11,
116 ELMTYP_AMMETER = 0x13,
117 ELMTYP_SCSI_TGT = 0x14,
118 ELMTYP_SCSI_INI = 0x15,
119 ELMTYP_SUBENC = 0x16,
120 ELMTYP_ARRAY_DEV = 0x17,
121 ELMTYP_SAS_EXP = 0x18, /* SAS expander */
122 ELMTYP_SAS_CONN = 0x19 /* SAS connector */
125 typedef struct encioc_element {
127 unsigned int elm_idx;
129 /* ID of SubEnclosure containing Element*/
130 unsigned int elm_subenc_id;
137 * Overall Enclosure Status
139 typedef unsigned char encioc_enc_status_t;
144 typedef struct encioc_elm_status {
145 unsigned int elm_idx;
146 unsigned char cstat[4];
147 } encioc_elm_status_t;
150 * ENC String structure, for StringIn and StringOut commands; use this with
151 * the ENCIOC_GETSTRING and ENCIOC_SETSTRING ioctls.
153 typedef struct encioc_string {
154 size_t bufsiz; /* IN/OUT: length of string provided/returned */
155 #define ENC_STRING_MAX 0xffff
156 uint8_t *buf; /* IN/OUT: string */
159 /*============================================================================*/
162 * SES v2 r20 6.1.10 (pg 39) - Element Descriptor diagnostic page
163 * Tables 21, 22, and 23
165 typedef struct encioc_elm_desc {
166 unsigned int elm_idx; /* IN: elment requested */
167 uint16_t elm_desc_len; /* IN: buffer size; OUT: bytes written */
168 char *elm_desc_str; /* IN/OUT: buffer for descriptor data */
172 * ENCIOC_GETELMDEVNAMES:
173 * ioctl structure to get an element's device names, if available
175 typedef struct encioc_elm_devnames {
176 unsigned int elm_idx; /* IN: element index */
177 size_t elm_names_size;/* IN: size of elm_devnames */
178 size_t elm_names_len; /* OUT: actual size returned */
180 * IN/OUT: comma separated list of peripheral driver
181 * instances servicing this element.
184 } encioc_elm_devnames_t;
186 /* ioctl structure for requesting FC info for a port */
187 typedef struct encioc_elm_fc_port {
188 unsigned int elm_idx;
189 unsigned int port_idx;
190 struct ses_elm_fc_port port_data;
191 } encioc_elm_fc_port_t;
193 /* ioctl structure for requesting SAS info for element phys */
194 typedef struct encioc_elm_sas_device_phy {
195 unsigned int elm_idx;
196 unsigned int phy_idx;
197 struct ses_elm_sas_device_phy phy_data;
198 } enioc_elm_sas_phy_t;
200 /* ioctl structure for requesting SAS info for an expander phy */
201 typedef struct encioc_elm_sas_expander_phy {
202 unsigned int elm_idx;
203 unsigned int phy_idx;
204 struct ses_elm_sas_expander_phy phy_data;
205 } encioc_elm_sas_expander_phy_t;
207 /* ioctl structure for requesting SAS info for a port phy */
208 typedef struct encioc_elm_sas_port_phy {
209 unsigned int elm_idx;
210 unsigned int phy_idx;
211 struct ses_elm_sas_port_phy phy_data;
212 } enioc_elm_sas_port_phy_t;
214 /* ioctl structure for requesting additional status for an element */
215 typedef struct encioc_addl_status {
216 unsigned int elm_idx;
217 union ses_elm_addlstatus_descr_hdr addl_hdr;
218 union ses_elm_addlstatus_proto_hdr proto_hdr;
219 } enioc_addl_status_t;
221 #endif /* _SCSI_ENC_H_ */