1 /* $FreeBSD$ */ 2 /*- 3 * SPDX-License-Identifier: (BSD-2-Clause-FreeBSD OR GPL-2.0) 4 * 5 * Copyright (c) 2000 by Matthew Jacob 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions, and the following disclaimer, 13 * without modification, immediately at the beginning of the file. 14 * 2. The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * Alternatively, this software may be distributed under the terms of the 18 * the GNU Public License ("GPL"). 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 24 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 */ 33 34 #ifndef _SCSI_SES_H_ 35 #define _SCSI_SES_H_ 36 37 #include <cam/scsi/scsi_all.h> 38 39 /*========================== Field Extraction Macros =========================*/ 40 #define MK_ENUM(S, F, SUFFIX) S ## _ ## F ## SUFFIX 41 42 #define GEN_GETTER(LS, US, LF, UF) \ 43 static inline int \ 44 LS ## _get_ ## LF(struct LS *elem) { \ 45 return ((elem->bytes[MK_ENUM(US,UF,_BYTE)] & MK_ENUM(US,UF,_MASK)) \ 46 >> MK_ENUM(US,UF,_SHIFT)); \ 47 } 48 49 #define GEN_SETTER(LS, US, LF, UF) \ 50 static inline void \ 51 LS ## _set_ ## LF(struct LS *elem, int val) { \ 52 elem->bytes[MK_ENUM(US,UF,_BYTE)] &= ~MK_ENUM(US,UF,_MASK); \ 53 elem->bytes[MK_ENUM(US,UF,_BYTE)] |= \ 54 (val << MK_ENUM(US,UF,_SHIFT)) & MK_ENUM(US,UF,_MASK); \ 55 } 56 57 #define GEN_HDR_GETTER(LS, US, LF, UF) \ 58 static inline int \ 59 LS ## _get_ ## LF(struct LS *page) { \ 60 return ((page->hdr.page_specific_flags & MK_ENUM(US,UF,_MASK)) \ 61 >> MK_ENUM(US,UF,_SHIFT)); \ 62 } 63 64 #define GEN_HDR_SETTER(LS, US, LF, UF) \ 65 static inline void \ 66 LS ## _set_ ## LF(struct LS *page, int val) { \ 67 page->hdr.page_specific_flags &= ~MK_ENUM(US,UF,_MASK); \ 68 page->hdr.page_specific_flags |= \ 69 (val << MK_ENUM(US,UF,_SHIFT)) & MK_ENUM(US,UF,_MASK); \ 70 } 71 72 #define GEN_ACCESSORS(LS, US, LF, UF) \ 73 GEN_GETTER(LS, US, LF, UF) \ 74 GEN_SETTER(LS, US, LF, UF) 75 76 #define GEN_HDR_ACCESSORS(LS, US, LF, UF) \ 77 GEN_HDR_GETTER(LS, US, LF, UF) \ 78 GEN_HDR_SETTER(LS, US, LF, UF) 79 80 /*=============== Common SCSI ENC Diagnostic Page Structures ===============*/ 81 struct ses_page_hdr { 82 uint8_t page_code; 83 uint8_t page_specific_flags; 84 uint8_t length[2]; 85 uint8_t gen_code[4]; 86 }; 87 88 static inline size_t 89 ses_page_length(const struct ses_page_hdr *hdr) 90 { 91 /* 92 * The page length as received only accounts for bytes that 93 * follow the length field, namely starting with the generation 94 * code field. 95 */ 96 return (scsi_2btoul(hdr->length) 97 + offsetof(struct ses_page_hdr, gen_code)); 98 } 99 100 /*============= SCSI ENC Configuration Diagnostic Page Structures ============*/ 101 struct ses_enc_desc { 102 uint8_t byte0; 103 /* 104 * reserved0 : 1, 105 * rel_id : 3, relative enclosure process id 106 * reserved1 : 1, 107 * num_procs : 3; number of enclosure procesenc 108 */ 109 uint8_t subenc_id; /* Sub-enclosure Identifier */ 110 uint8_t num_types; /* # of supported types */ 111 uint8_t length; /* Enclosure Descriptor Length */ 112 uint8_t logical_id[8]; /* formerly wwn */ 113 uint8_t vendor_id[8]; 114 uint8_t product_id[16]; 115 uint8_t product_rev[4]; 116 uint8_t vendor_bytes[]; 117 }; 118 119 static inline uint8_t * 120 ses_enc_desc_last_byte(struct ses_enc_desc *encdesc) 121 { 122 return (&encdesc->length + encdesc->length); 123 } 124 125 static inline struct ses_enc_desc * 126 ses_enc_desc_next(struct ses_enc_desc *encdesc) 127 { 128 return ((struct ses_enc_desc *)(ses_enc_desc_last_byte(encdesc) + 1)); 129 } 130 131 static inline int 132 ses_enc_desc_is_complete(struct ses_enc_desc *encdesc, uint8_t *last_buf_byte) 133 { 134 return (&encdesc->length <= last_buf_byte 135 && ses_enc_desc_last_byte(encdesc) <= last_buf_byte); 136 } 137 138 struct ses_elm_type_desc { 139 uint8_t etype_elm_type; /* type of element */ 140 uint8_t etype_maxelt; /* maximum supported */ 141 uint8_t etype_subenc; /* in sub-enclosure #n */ 142 uint8_t etype_txt_len; /* Type Descriptor Text Length */ 143 }; 144 145 struct ses_cfg_page { 146 struct ses_page_hdr hdr; 147 struct ses_enc_desc subencs[]; 148 /* type descriptors */ 149 /* type text */ 150 }; 151 152 static inline int 153 ses_cfg_page_get_num_subenc(struct ses_cfg_page *page) 154 { 155 return (page->hdr.page_specific_flags + 1); 156 } 157 158 159 /*================ SCSI SES Control Diagnostic Page Structures ==============*/ 160 struct ses_ctrl_common { 161 uint8_t bytes[1]; 162 }; 163 164 enum ses_ctrl_common_field_data { 165 SES_CTRL_COMMON_SELECT_BYTE = 0, 166 SES_CTRL_COMMON_SELECT_MASK = 0x80, 167 SES_CTRL_COMMON_SELECT_SHIFT = 7, 168 169 SES_CTRL_COMMON_PRDFAIL_BYTE = 0, 170 SES_CTRL_COMMON_PRDFAIL_MASK = 0x40, 171 SES_CTRL_COMMON_PRDFAIL_SHIFT = 6, 172 173 SES_CTRL_COMMON_DISABLE_BYTE = 0, 174 SES_CTRL_COMMON_DISABLE_MASK = 0x20, 175 SES_CTRL_COMMON_DISABLE_SHIFT = 5, 176 177 SES_CTRL_COMMON_RST_SWAP_BYTE = 0, 178 SES_CTRL_COMMON_RST_SWAP_MASK = 0x10, 179 SES_CTRL_COMMON_RST_SWAP_SHIFT = 4 180 }; 181 182 #define GEN_SES_CTRL_COMMON_ACCESSORS(LCASE, UCASE) \ 183 GEN_ACCESSORS(ses_ctrl_common, SES_CTRL_COMMON, LCASE, UCASE) 184 GEN_SES_CTRL_COMMON_ACCESSORS(select, SELECT) 185 GEN_SES_CTRL_COMMON_ACCESSORS(prdfail, PRDFAIL) 186 GEN_SES_CTRL_COMMON_ACCESSORS(disable, DISABLE) 187 GEN_SES_CTRL_COMMON_ACCESSORS(rst_swap, RST_SWAP) 188 #undef GEN_SES_CTRL_COMMON_ACCESSORS 189 190 /*------------------------ Device Slot Control Element ----------------------*/ 191 struct ses_ctrl_dev_slot { 192 struct ses_ctrl_common common; 193 uint8_t bytes[3]; 194 }; 195 196 enum ses_ctrl_dev_slot_field_data { 197 SES_CTRL_DEV_SLOT_RQST_ACTIVE_BYTE = 1, 198 SES_CTRL_DEV_SLOT_RQST_ACTIVE_MASK = 0x80, 199 SES_CTRL_DEV_SLOT_RQST_ACTIVE_SHIFT = 7, 200 201 SES_CTRL_DEV_SLOT_DO_NOT_REMOVE_BYTE = 1, 202 SES_CTRL_DEV_SLOT_DO_NOT_REMOVE_MASK = 0x40, 203 SES_CTRL_DEV_SLOT_DO_NOT_REMOVE_SHIFT = 6, 204 205 SES_CTRL_DEV_SLOT_RQST_MISSING_BYTE = 1, 206 SES_CTRL_DEV_SLOT_RQST_MISSING_MASK = 0x10, 207 SES_CTRL_DEV_SLOT_RQST_MISSING_SHIFT = 4, 208 209 SES_CTRL_DEV_SLOT_RQST_INSERT_BYTE = 1, 210 SES_CTRL_DEV_SLOT_RQST_INSERT_MASK = 0x08, 211 SES_CTRL_DEV_SLOT_RQST_INSERT_SHIFT = 3, 212 213 SES_CTRL_DEV_SLOT_RQST_REMOVE_BYTE = 1, 214 SES_CTRL_DEV_SLOT_RQST_REMOVE_MASK = 0x04, 215 SES_CTRL_DEV_SLOT_RQST_REMOVE_SHIFT = 2, 216 217 SES_CTRL_DEV_SLOT_RQST_IDENT_BYTE = 1, 218 SES_CTRL_DEV_SLOT_RQST_IDENT_MASK = 0x02, 219 SES_CTRL_DEV_SLOT_RQST_IDENT_SHIFT = 1, 220 221 SES_CTRL_DEV_SLOT_RQST_FAULT_BYTE = 2, 222 SES_CTRL_DEV_SLOT_RQST_FAULT_MASK = 0x20, 223 SES_CTRL_DEV_SLOT_RQST_FAULT_SHIFT = 5, 224 225 SES_CTRL_DEV_SLOT_DEVICE_OFF_BYTE = 2, 226 SES_CTRL_DEV_SLOT_DEVICE_OFF_MASK = 0x10, 227 SES_CTRL_DEV_SLOT_DEVICE_OFF_SHIFT = 4, 228 229 SES_CTRL_DEV_SLOT_ENABLE_BYP_A_BYTE = 2, 230 SES_CTRL_DEV_SLOT_ENABLE_BYP_A_MASK = 0x08, 231 SES_CTRL_DEV_SLOT_ENABLE_BYP_A_SHIFT = 3, 232 233 SES_CTRL_DEV_SLOT_ENABLE_BYP_B_BYTE = 2, 234 SES_CTRL_DEV_SLOT_ENABLE_BYP_B_MASK = 0x04, 235 SES_CTRL_DEV_SLOT_ENABLE_BYP_B_SHIFT = 2 236 }; 237 #define GEN_SES_CTRL_DEV_SLOT_ACCESSORS(LCASE, UCASE) \ 238 GEN_ACCESSORS(ses_ctrl_dev_slot, SES_CTRL_DEV_SLOT, LCASE, UCASE) 239 240 GEN_SES_CTRL_DEV_SLOT_ACCESSORS(rqst_active, RQST_ACTIVE) 241 GEN_SES_CTRL_DEV_SLOT_ACCESSORS(do_not_remove, DO_NOT_REMOVE) 242 GEN_SES_CTRL_DEV_SLOT_ACCESSORS(rqst_missing, RQST_MISSING) 243 GEN_SES_CTRL_DEV_SLOT_ACCESSORS(rqst_insert, RQST_INSERT) 244 GEN_SES_CTRL_DEV_SLOT_ACCESSORS(rqst_remove, RQST_REMOVE) 245 GEN_SES_CTRL_DEV_SLOT_ACCESSORS(rqst_ident, RQST_IDENT) 246 GEN_SES_CTRL_DEV_SLOT_ACCESSORS(rqst_fault, RQST_FAULT) 247 GEN_SES_CTRL_DEV_SLOT_ACCESSORS(device_off, DEVICE_OFF) 248 GEN_SES_CTRL_DEV_SLOT_ACCESSORS(enable_byp_a, ENABLE_BYP_A) 249 GEN_SES_CTRL_DEV_SLOT_ACCESSORS(enable_byp_b, ENABLE_BYP_B) 250 #undef GEN_SES_CTRL_DEV_SLOT_ACCESSORS 251 252 /*--------------------- Array Device Slot Control Element --------------------*/ 253 struct ses_ctrl_array_dev_slot { 254 struct ses_ctrl_common common; 255 uint8_t bytes[3]; 256 }; 257 258 enum ses_ctrl_array_dev_slot_field_data { 259 SES_CTRL_ARRAY_DEV_SLOT_RQST_OK_BYTE = 0, 260 SES_CTRL_ARRAY_DEV_SLOT_RQST_OK_MASK = 0x80, 261 SES_CTRL_ARRAY_DEV_SLOT_RQST_OK_SHIFT = 7, 262 263 SES_CTRL_ARRAY_DEV_SLOT_RQST_RSVD_DEVICE_BYTE = 0, 264 SES_CTRL_ARRAY_DEV_SLOT_RQST_RSVD_DEVICE_MASK = 0x40, 265 SES_CTRL_ARRAY_DEV_SLOT_RQST_RSVD_DEVICE_SHIFT = 6, 266 267 SES_CTRL_ARRAY_DEV_SLOT_RQST_HOT_SPARE_BYTE = 0, 268 SES_CTRL_ARRAY_DEV_SLOT_RQST_HOT_SPARE_MASK = 0x20, 269 SES_CTRL_ARRAY_DEV_SLOT_RQST_HOT_SPARE_SHIFT = 5, 270 271 SES_CTRL_ARRAY_DEV_SLOT_RQST_CONS_CHECK_BYTE = 0, 272 SES_CTRL_ARRAY_DEV_SLOT_RQST_CONS_CHECK_MASK = 0x10, 273 SES_CTRL_ARRAY_DEV_SLOT_RQST_CONS_CHECK_SHIFT = 4, 274 275 SES_CTRL_ARRAY_DEV_SLOT_RQST_IN_CRIT_ARRAY_BYTE = 0, 276 SES_CTRL_ARRAY_DEV_SLOT_RQST_IN_CRIT_ARRAY_MASK = 0x08, 277 SES_CTRL_ARRAY_DEV_SLOT_RQST_IN_CRIT_ARRAY_SHIFT = 3, 278 279 SES_CTRL_ARRAY_DEV_SLOT_RQST_IN_FAILED_ARRAY_BYTE = 0, 280 SES_CTRL_ARRAY_DEV_SLOT_RQST_IN_FAILED_ARRAY_MASK = 0x04, 281 SES_CTRL_ARRAY_DEV_SLOT_RQST_IN_FAILED_ARRAY_SHIFT = 2, 282 283 SES_CTRL_ARRAY_DEV_SLOT_RQST_REBUILD_REMAP_BYTE = 0, 284 SES_CTRL_ARRAY_DEV_SLOT_RQST_REBUILD_REMAP_MASK = 0x02, 285 SES_CTRL_ARRAY_DEV_SLOT_RQST_REBUILD_REMAP_SHIFT = 1, 286 287 SES_CTRL_ARRAY_DEV_SLOT_RQST_REBUILD_REMAP_ABORT_BYTE = 0, 288 SES_CTRL_ARRAY_DEV_SLOT_RQST_REBUILD_REMAP_ABORT_MASK = 0x01, 289 SES_CTRL_ARRAY_DEV_SLOT_RQST_REBUILD_REMAP_ABORT_SHIFT = 0 290 291 /* 292 * The remaining fields are identical to the device 293 * slot element type. Access them through the device slot 294 * element type and its accessors. 295 */ 296 }; 297 #define GEN_SES_CTRL_ARRAY_DEV_SLOT_ACCESSORS(LCASE, UCASE) \ 298 GEN_ACCESSORS(ses_ctrl_array_dev_slot, SES_CTRL_ARRAY_DEV_SLOT, \ 299 LCASE, UCASE) 300 GEN_SES_CTRL_ARRAY_DEV_SLOT_ACCESSORS(rqst_ok, RQST_OK) 301 GEN_SES_CTRL_ARRAY_DEV_SLOT_ACCESSORS(rqst_rsvd_device, RQST_RSVD_DEVICE) 302 GEN_SES_CTRL_ARRAY_DEV_SLOT_ACCESSORS(rqst_hot_spare, RQST_HOT_SPARE) 303 GEN_SES_CTRL_ARRAY_DEV_SLOT_ACCESSORS(rqst_cons_check, RQST_CONS_CHECK) 304 GEN_SES_CTRL_ARRAY_DEV_SLOT_ACCESSORS(rqst_in_crit_array, RQST_IN_CRIT_ARRAY) 305 GEN_SES_CTRL_ARRAY_DEV_SLOT_ACCESSORS(rqst_in_failed_array, 306 RQST_IN_FAILED_ARRAY) 307 GEN_SES_CTRL_ARRAY_DEV_SLOT_ACCESSORS(rqst_rebuild_remap, RQST_REBUILD_REMAP) 308 GEN_SES_CTRL_ARRAY_DEV_SLOT_ACCESSORS(rqst_rebuild_remap_abort, 309 RQST_REBUILD_REMAP_ABORT) 310 #undef GEN_SES_CTRL_ARRAY_DEV_SLOT_ACCESSORS 311 312 /*----------------------- Power Supply Control Element -----------------------*/ 313 struct ses_ctrl_power_supply { 314 struct ses_ctrl_common common; 315 uint8_t bytes[3]; 316 }; 317 318 enum ses_ctrl_power_supply_field_data { 319 SES_CTRL_POWER_SUPPLY_RQST_IDENT_BYTE = 0, 320 SES_CTRL_POWER_SUPPLY_RQST_IDENT_MASK = 0x80, 321 SES_CTRL_POWER_SUPPLY_RQST_IDENT_SHIFT = 7, 322 323 SES_CTRL_POWER_SUPPLY_RQST_FAIL_BYTE = 2, 324 SES_CTRL_POWER_SUPPLY_RQST_FAIL_MASK = 0x40, 325 SES_CTRL_POWER_SUPPLY_RQST_FAIL_SHIFT = 6, 326 327 SES_CTRL_POWER_SUPPLY_RQST_ON_BYTE = 2, 328 SES_CTRL_POWER_SUPPLY_RQST_ON_MASK = 0x20, 329 SES_CTRL_POWER_SUPPLY_RQST_ON_SHIFT = 5 330 }; 331 332 #define GEN_SES_CTRL_POWER_SUPPLY_ACCESSORS(LCASE, UCASE) \ 333 GEN_ACCESSORS(ses_ctrl_power_supply, SES_CTRL_POWER_SUPPLY, LCASE, UCASE) 334 GEN_SES_CTRL_POWER_SUPPLY_ACCESSORS(rqst_ident, RQST_IDENT) 335 GEN_SES_CTRL_POWER_SUPPLY_ACCESSORS(rqst_fail, RQST_FAIL) 336 GEN_SES_CTRL_POWER_SUPPLY_ACCESSORS(rqst_on, RQST_ON) 337 #undef GEN_SES_CTRL_POWER_SUPPLY_ACCESSORS 338 339 /*-------------------------- Cooling Control Element -------------------------*/ 340 struct ses_ctrl_cooling { 341 struct ses_ctrl_common common; 342 uint8_t bytes[3]; 343 }; 344 345 enum ses_ctrl_cooling_field_data { 346 SES_CTRL_COOLING_RQST_IDENT_BYTE = 0, 347 SES_CTRL_COOLING_RQST_IDENT_MASK = 0x80, 348 SES_CTRL_COOLING_RQST_IDENT_SHIFT = 7, 349 350 SES_CTRL_COOLING_RQST_FAIL_BYTE = 2, 351 SES_CTRL_COOLING_RQST_FAIL_MASK = 0x40, 352 SES_CTRL_COOLING_RQST_FAIL_SHIFT = 6, 353 354 SES_CTRL_COOLING_RQST_ON_BYTE = 2, 355 SES_CTRL_COOLING_RQST_ON_MASK = 0x20, 356 SES_CTRL_COOLING_RQST_ON_SHIFT = 5, 357 358 SES_CTRL_COOLING_RQSTED_SPEED_CODE_BYTE = 2, 359 SES_CTRL_COOLING_RQSTED_SPEED_CODE_MASK = 0x07, 360 SES_CTRL_COOLING_RQSTED_SPEED_CODE_SHIFT = 2, 361 SES_CTRL_COOLING_RQSTED_SPEED_CODE_UNCHANGED = 0x00, 362 SES_CTRL_COOLING_RQSTED_SPEED_CODE_LOWEST = 0x01, 363 SES_CTRL_COOLING_RQSTED_SPEED_CODE_HIGHEST = 0x07 364 }; 365 366 #define GEN_SES_CTRL_COOLING_ACCESSORS(LCASE, UCASE) \ 367 GEN_ACCESSORS(ses_ctrl_cooling, SES_CTRL_COOLING, LCASE, UCASE) 368 GEN_SES_CTRL_COOLING_ACCESSORS(rqst_ident, RQST_IDENT) 369 GEN_SES_CTRL_COOLING_ACCESSORS(rqst_fail, RQST_FAIL) 370 GEN_SES_CTRL_COOLING_ACCESSORS(rqst_on, RQST_ON) 371 GEN_SES_CTRL_COOLING_ACCESSORS(rqsted_speed_code, RQSTED_SPEED_CODE) 372 #undef GEN_SES_CTRL_COOLING_ACCESSORS 373 374 /*-------------------- Temperature Sensor Control Element --------------------*/ 375 struct ses_ctrl_temp_sensor { 376 struct ses_ctrl_common common; 377 uint8_t bytes[3]; 378 }; 379 380 enum ses_ctrl_temp_sensor_field_data { 381 SES_CTRL_TEMP_SENSOR_RQST_IDENT_BYTE = 0, 382 SES_CTRL_TEMP_SENSOR_RQST_IDENT_MASK = 0x80, 383 SES_CTRL_TEMP_SENSOR_RQST_IDENT_SHIFT = 7, 384 385 SES_CTRL_TEMP_SENSOR_RQST_FAIL_BYTE = 0, 386 SES_CTRL_TEMP_SENSOR_RQST_FAIL_MASK = 0x40, 387 SES_CTRL_TEMP_SENSOR_RQST_FAIL_SHIFT = 6 388 }; 389 390 #define GEN_SES_CTRL_TEMP_SENSOR_ACCESSORS(LCASE, UCASE) \ 391 GEN_ACCESSORS(ses_ctrl_temp_sensor, SES_CTRL_TEMP_SENSOR, LCASE, UCASE) 392 GEN_SES_CTRL_TEMP_SENSOR_ACCESSORS(rqst_ident, RQST_IDENT) 393 GEN_SES_CTRL_TEMP_SENSOR_ACCESSORS(rqst_fail, RQST_FAIL) 394 #undef GEN_SES_CTRL_TEMP_SENSOR_ACCESSORS 395 396 /*------------------------- Door Lock Control Element ------------------------*/ 397 struct ses_ctrl_door_lock { 398 struct ses_ctrl_common common; 399 uint8_t bytes[3]; 400 }; 401 402 enum ses_ctrl_door_lock_field_data { 403 SES_CTRL_DOOR_LOCK_RQST_IDENT_BYTE = 0, 404 SES_CTRL_DOOR_LOCK_RQST_IDENT_MASK = 0x80, 405 SES_CTRL_DOOR_LOCK_RQST_IDENT_SHIFT = 7, 406 407 SES_CTRL_DOOR_LOCK_RQST_FAIL_BYTE = 0, 408 SES_CTRL_DOOR_LOCK_RQST_FAIL_MASK = 0x40, 409 SES_CTRL_DOOR_LOCK_RQST_FAIL_SHIFT = 6, 410 411 SES_CTRL_DOOR_LOCK_UNLOCK_BYTE = 2, 412 SES_CTRL_DOOR_LOCK_UNLOCK_MASK = 0x01, 413 SES_CTRL_DOOR_LOCK_UNLOCK_SHIFT = 0 414 }; 415 416 #define GEN_SES_CTRL_DOOR_LOCK_ACCESSORS(LCASE, UCASE) \ 417 GEN_ACCESSORS(ses_ctrl_door_lock, SES_CTRL_DOOR_LOCK, LCASE, UCASE) 418 GEN_SES_CTRL_DOOR_LOCK_ACCESSORS(rqst_ident, RQST_IDENT) 419 GEN_SES_CTRL_DOOR_LOCK_ACCESSORS(rqst_fail, RQST_FAIL) 420 GEN_SES_CTRL_DOOR_LOCK_ACCESSORS(unlock, UNLOCK) 421 #undef GEN_SES_CTRL_DOOR_LOCK_ACCESSORS 422 423 /*----------------------- Audible Alarm Control Element ----------------------*/ 424 struct ses_ctrl_audible_alarm { 425 struct ses_ctrl_common common; 426 uint8_t bytes[3]; 427 }; 428 429 enum ses_ctrl_audible_alarm_field_data { 430 SES_CTRL_AUDIBLE_ALARM_RQST_IDENT_BYTE = 0, 431 SES_CTRL_AUDIBLE_ALARM_RQST_IDENT_MASK = 0x80, 432 SES_CTRL_AUDIBLE_ALARM_RQST_IDENT_SHIFT = 7, 433 434 SES_CTRL_AUDIBLE_ALARM_RQST_FAIL_BYTE = 0, 435 SES_CTRL_AUDIBLE_ALARM_RQST_FAIL_MASK = 0x40, 436 SES_CTRL_AUDIBLE_ALARM_RQST_FAIL_SHIFT = 6, 437 438 SES_CTRL_AUDIBLE_ALARM_SET_MUTE_BYTE = 2, 439 SES_CTRL_AUDIBLE_ALARM_SET_MUTE_MASK = 0x40, 440 SES_CTRL_AUDIBLE_ALARM_SET_MUTE_SHIFT = 6, 441 442 SES_CTRL_AUDIBLE_ALARM_SET_REMIND_BYTE = 2, 443 SES_CTRL_AUDIBLE_ALARM_SET_REMIND_MASK = 0x10, 444 SES_CTRL_AUDIBLE_ALARM_SET_REMIND_SHIFT = 4, 445 446 SES_CTRL_AUDIBLE_ALARM_TONE_CONTROL_BYTE = 2, 447 SES_CTRL_AUDIBLE_ALARM_TONE_CONTROL_MASK = 0x0F, 448 SES_CTRL_AUDIBLE_ALARM_TONE_CONTROL_SHIFT = 0, 449 SES_CTRL_AUDIBLE_ALARM_TONE_CONTROL_INFO = 0x08, 450 SES_CTRL_AUDIBLE_ALARM_TONE_CONTROL_NON_CRIT = 0x04, 451 SES_CTRL_AUDIBLE_ALARM_TONE_CONTROL_CRIT = 0x02, 452 SES_CTRL_AUDIBLE_ALARM_TONE_CONTROL_UNRECOV = 0x01 453 }; 454 455 #define GEN_SES_CTRL_AUDIBLE_ALARM_ACCESSORS(LCASE, UCASE) \ 456 GEN_ACCESSORS(ses_ctrl_audible_alarm, SES_CTRL_AUDIBLE_ALARM, LCASE, UCASE) 457 GEN_SES_CTRL_AUDIBLE_ALARM_ACCESSORS(rqst_ident, RQST_IDENT) 458 GEN_SES_CTRL_AUDIBLE_ALARM_ACCESSORS(rqst_fail, RQST_FAIL) 459 GEN_SES_CTRL_AUDIBLE_ALARM_ACCESSORS(set_mute, SET_MUTE) 460 GEN_SES_CTRL_AUDIBLE_ALARM_ACCESSORS(set_remind, SET_REMIND) 461 GEN_SES_CTRL_AUDIBLE_ALARM_ACCESSORS(tone_control, TONE_CONTROL) 462 #undef GEN_SES_CTRL_AUDIBLE_ALARM_ACCESSORS 463 464 /*--------- Enclosure Services Controller Electronics Control Element --------*/ 465 struct ses_ctrl_ecc_electronics { 466 struct ses_ctrl_common common; 467 uint8_t bytes[3]; 468 }; 469 470 enum ses_ctrl_ecc_electronics_field_data { 471 SES_CTRL_ECC_ELECTRONICS_RQST_IDENT_BYTE = 0, 472 SES_CTRL_ECC_ELECTRONICS_RQST_IDENT_MASK = 0x80, 473 SES_CTRL_ECC_ELECTRONICS_RQST_IDENT_SHIFT = 7, 474 475 SES_CTRL_ECC_ELECTRONICS_RQST_FAIL_BYTE = 0, 476 SES_CTRL_ECC_ELECTRONICS_RQST_FAIL_MASK = 0x40, 477 SES_CTRL_ECC_ELECTRONICS_RQST_FAIL_SHIFT = 6, 478 479 SES_CTRL_ECC_ELECTRONICS_SELECT_ELEMENT_BYTE = 1, 480 SES_CTRL_ECC_ELECTRONICS_SELECT_ELEMENT_MASK = 0x01, 481 SES_CTRL_ECC_ELECTRONICS_SELECT_ELEMENT_SHIFT = 0 482 }; 483 484 #define GEN_SES_CTRL_ECC_ELECTRONICS_ACCESSORS(LCASE, UCASE) \ 485 GEN_ACCESSORS(ses_ctrl_ecc_electronics, SES_CTRL_ECC_ELECTRONICS, \ 486 LCASE, UCASE) 487 GEN_SES_CTRL_ECC_ELECTRONICS_ACCESSORS(rqst_ident, RQST_IDENT) 488 GEN_SES_CTRL_ECC_ELECTRONICS_ACCESSORS(rqst_fail, RQST_FAIL) 489 GEN_SES_CTRL_ECC_ELECTRONICS_ACCESSORS(select_element, SELECT_ELEMENT) 490 #undef GEN_SES_CTRL_ECC_ELECTRONICS_ACCESSORS 491 492 /*----------- SCSI Services Controller Electronics Control Element -----------*/ 493 struct ses_ctrl_scc_electronics { 494 struct ses_ctrl_common common; 495 uint8_t bytes[3]; 496 }; 497 498 enum ses_ctrl_scc_electronics_field_data { 499 SES_CTRL_SCC_ELECTRONICS_RQST_IDENT_BYTE = 0, 500 SES_CTRL_SCC_ELECTRONICS_RQST_IDENT_MASK = 0x80, 501 SES_CTRL_SCC_ELECTRONICS_RQST_IDENT_SHIFT = 7, 502 503 SES_CTRL_SCC_ELECTRONICS_RQST_FAIL_BYTE = 0, 504 SES_CTRL_SCC_ELECTRONICS_RQST_FAIL_MASK = 0x40, 505 SES_CTRL_SCC_ELECTRONICS_RQST_FAIL_SHIFT = 6 506 }; 507 508 #define GEN_SES_CTRL_SCC_ELECTRONICS_ACCESSORS(LCASE, UCASE) \ 509 GEN_ACCESSORS(ses_ctrl_scc_electronics, SES_CTRL_SCC_ELECTRONICS, \ 510 LCASE, UCASE) 511 GEN_SES_CTRL_SCC_ELECTRONICS_ACCESSORS(rqst_ident, RQST_IDENT) 512 GEN_SES_CTRL_SCC_ELECTRONICS_ACCESSORS(rqst_fail, RQST_FAIL) 513 #undef GEN_SES_CTRL_SCC_ELECTRONICS_ACCESSORS 514 515 /*--------------------- Nonvolatile Cache Control Element --------------------*/ 516 struct ses_ctrl_nv_cache { 517 struct ses_ctrl_common common; 518 uint8_t bytes[3]; 519 }; 520 521 enum ses_ctrl_nv_cache_field_data { 522 SES_CTRL_NV_CACHE_RQST_IDENT_BYTE = 0, 523 SES_CTRL_NV_CACHE_RQST_IDENT_MASK = 0x80, 524 SES_CTRL_NV_CACHE_RQST_IDENT_SHIFT = 7, 525 526 SES_CTRL_NV_CACHE_RQST_FAIL_BYTE = 0, 527 SES_CTRL_NV_CACHE_RQST_FAIL_MASK = 0x40, 528 SES_CTRL_NV_CACHE_RQST_FAIL_SHIFT = 6 529 }; 530 531 #define GEN_SES_CTRL_NV_CACHE_ACCESSORS(LCASE, UCASE) \ 532 GEN_ACCESSORS(ses_ctrl_nv_cache, SES_CTRL_NV_CACHE, LCASE, UCASE) 533 GEN_SES_CTRL_NV_CACHE_ACCESSORS(rqst_ident, RQST_IDENT) 534 GEN_SES_CTRL_NV_CACHE_ACCESSORS(rqst_fail, RQST_FAIL) 535 #undef GEN_SES_CTRL_NV_CACHE_ACCESSORS 536 537 /*----------------- Invalid Operation Reason Control Element -----------------*/ 538 struct ses_ctrl_invalid_op_reason { 539 struct ses_ctrl_common common; 540 uint8_t bytes[3]; 541 }; 542 543 /* There are no element specific fields currently defined in the spec. */ 544 545 /*--------------- Uninterruptible Power Supply Control Element ---------------*/ 546 struct ses_ctrl_ups { 547 struct ses_ctrl_common common; 548 uint8_t bytes[3]; 549 }; 550 551 enum ses_ctrl_ups_field_data { 552 SES_CTRL_UPS_RQST_IDENT_BYTE = 2, 553 SES_CTRL_UPS_RQST_IDENT_MASK = 0x80, 554 SES_CTRL_UPS_RQST_IDENT_SHIFT = 7, 555 556 SES_CTRL_UPS_RQST_FAIL_BYTE = 2, 557 SES_CTRL_UPS_RQST_FAIL_MASK = 0x40, 558 SES_CTRL_UPS_RQST_FAIL_SHIFT = 6 559 }; 560 561 #define GEN_SES_CTRL_UPS_ACCESSORS(LCASE, UCASE) \ 562 GEN_ACCESSORS(ses_ctrl_ups, SES_CTRL_UPS, LCASE, UCASE) 563 GEN_SES_CTRL_UPS_ACCESSORS(rqst_ident, RQST_IDENT) 564 GEN_SES_CTRL_UPS_ACCESSORS(rqst_fail, RQST_FAIL) 565 #undef GEN_SES_CTRL_UPS_ACCESSORS 566 567 /*-------------------------- Display Control Element -------------------------*/ 568 struct ses_ctrl_display { 569 struct ses_ctrl_common common; 570 uint8_t bytes[1]; 571 uint8_t display_character[2]; 572 }; 573 574 enum ses_ctrl_display_field_data { 575 SES_CTRL_DISPLAY_RQST_IDENT_BYTE = 0, 576 SES_CTRL_DISPLAY_RQST_IDENT_MASK = 0x80, 577 SES_CTRL_DISPLAY_RQST_IDENT_SHIFT = 7, 578 579 SES_CTRL_DISPLAY_RQST_FAIL_BYTE = 0, 580 SES_CTRL_DISPLAY_RQST_FAIL_MASK = 0x40, 581 SES_CTRL_DISPLAY_RQST_FAIL_SHIFT = 6, 582 583 SES_CTRL_DISPLAY_DISPLAY_MODE_BYTE = 0, 584 SES_CTRL_DISPLAY_DISPLAY_MODE_MASK = 0x03, 585 SES_CTRL_DISPLAY_DISPLAY_MODE_SHIFT = 6, 586 SES_CTRL_DISPLAY_DISPLAY_MODE_UNCHANGED = 0x0, 587 SES_CTRL_DISPLAY_DISPLAY_MODE_ESP = 0x1, 588 SES_CTRL_DISPLAY_DISPLAY_MODE_DC_FIELD = 0x2 589 }; 590 591 #define GEN_SES_CTRL_DISPLAY_ACCESSORS(LCASE, UCASE) \ 592 GEN_ACCESSORS(ses_ctrl_display, SES_CTRL_DISPLAY, LCASE, UCASE) 593 GEN_SES_CTRL_DISPLAY_ACCESSORS(rqst_ident, RQST_IDENT) 594 GEN_SES_CTRL_DISPLAY_ACCESSORS(rqst_fail, RQST_FAIL) 595 GEN_SES_CTRL_DISPLAY_ACCESSORS(display_mode, DISPLAY_MODE) 596 #undef GEN_SES_CTRL_DISPLAY_ACCESSORS 597 598 /*----------------------- Key Pad Entry Control Element ----------------------*/ 599 struct ses_ctrl_key_pad_entry { 600 struct ses_ctrl_common common; 601 uint8_t bytes[3]; 602 }; 603 604 enum ses_ctrl_key_pad_entry_field_data { 605 SES_CTRL_KEY_PAD_ENTRY_RQST_IDENT_BYTE = 0, 606 SES_CTRL_KEY_PAD_ENTRY_RQST_IDENT_MASK = 0x80, 607 SES_CTRL_KEY_PAD_ENTRY_RQST_IDENT_SHIFT = 7, 608 609 SES_CTRL_KEY_PAD_ENTRY_RQST_FAIL_BYTE = 0, 610 SES_CTRL_KEY_PAD_ENTRY_RQST_FAIL_MASK = 0x40, 611 SES_CTRL_KEY_PAD_ENTRY_RQST_FAIL_SHIFT = 6 612 }; 613 614 #define GEN_SES_CTRL_KEY_PAD_ENTRY_ACCESSORS(LCASE, UCASE) \ 615 GEN_ACCESSORS(ses_ctrl_key_pad_entry, SES_CTRL_KEY_PAD_ENTRY, LCASE, UCASE) 616 GEN_SES_CTRL_KEY_PAD_ENTRY_ACCESSORS(rqst_ident, RQST_IDENT) 617 GEN_SES_CTRL_KEY_PAD_ENTRY_ACCESSORS(rqst_fail, RQST_FAIL) 618 #undef GEN_SES_CTRL_KEY_PAD_ENTRY_ACCESSORS 619 620 /*------------------------- Enclosure Control Element ------------------------*/ 621 struct ses_ctrl_enclosure { 622 struct ses_ctrl_common common; 623 uint8_t bytes[3]; 624 }; 625 626 enum ses_ctrl_enclosure_field_data { 627 SES_CTRL_ENCLOSURE_RQST_IDENT_BYTE = 0, 628 SES_CTRL_ENCLOSURE_RQST_IDENT_MASK = 0x80, 629 SES_CTRL_ENCLOSURE_RQST_IDENT_SHIFT = 7, 630 631 SES_CTRL_ENCLOSURE_POWER_CYCLE_RQST_BYTE = 1, 632 SES_CTRL_ENCLOSURE_POWER_CYCLE_RQST_MASK = 0xC0, 633 SES_CTRL_ENCLOSURE_POWER_CYCLE_RQST_SHIFT = 6, 634 SES_CTRL_ENCLOSURE_POWER_CYCLE_RQST_NONE = 0x0, 635 SES_CTRL_ENCLOSURE_POWER_CYCLE_RQST_AFTER_DELAY = 0x1, 636 SES_CTRL_ENCLOSURE_POWER_CYCLE_RQST_CANCEL = 0x2, 637 638 SES_CTRL_ENCLOSURE_POWER_CYCLE_DELAY_BYTE = 1, 639 SES_CTRL_ENCLOSURE_POWER_CYCLE_DELAY_MASK = 0x3F, 640 SES_CTRL_ENCLOSURE_POWER_CYCLE_DELAY_SHIFT = 0, 641 SES_CTRL_ENCLOSURE_POWER_CYCLE_DELAY_MAX = 60,/*minutes*/ 642 643 SES_CTRL_ENCLOSURE_POWER_OFF_DURATION_BYTE = 2, 644 SES_CTRL_ENCLOSURE_POWER_OFF_DURATION_MASK = 0xFC, 645 SES_CTRL_ENCLOSURE_POWER_OFF_DURATION_SHIFT = 2, 646 SES_CTRL_ENCLOSURE_POWER_OFF_DURATION_MAX_AUTO = 60, 647 SES_CTRL_ENCLOSURE_POWER_OFF_DURATION_MANUAL = 63, 648 649 SES_CTRL_ENCLOSURE_RQST_FAIL_BYTE = 2, 650 SES_CTRL_ENCLOSURE_RQST_FAIL_MASK = 0x02, 651 SES_CTRL_ENCLOSURE_RQST_FAIL_SHIFT = 1, 652 653 SES_CTRL_ENCLOSURE_RQST_WARN_BYTE = 2, 654 SES_CTRL_ENCLOSURE_RQST_WARN_MASK = 0x01, 655 SES_CTRL_ENCLOSURE_RQST_WARN_SHIFT = 0 656 }; 657 658 #define GEN_SES_CTRL_ENCLOSURE_ACCESSORS(LCASE, UCASE) \ 659 GEN_ACCESSORS(ses_ctrl_enclosure, SES_CTRL_ENCLOSURE, LCASE, UCASE) 660 GEN_SES_CTRL_ENCLOSURE_ACCESSORS(rqst_ident, RQST_IDENT) 661 GEN_SES_CTRL_ENCLOSURE_ACCESSORS(power_cycle_rqst, POWER_CYCLE_RQST) 662 GEN_SES_CTRL_ENCLOSURE_ACCESSORS(power_cycle_delay, POWER_CYCLE_DELAY) 663 GEN_SES_CTRL_ENCLOSURE_ACCESSORS(power_off_duration, POWER_OFF_DURATION) 664 GEN_SES_CTRL_ENCLOSURE_ACCESSORS(rqst_fail, RQST_FAIL) 665 GEN_SES_CTRL_ENCLOSURE_ACCESSORS(rqst_warn, RQST_WARN) 666 #undef GEN_SES_CTRL_ENCLOSURE_ACCESSORS 667 668 /*------------------- SCSI Port/Transceiver Control Element ------------------*/ 669 struct ses_ctrl_scsi_port_or_xcvr { 670 struct ses_ctrl_common common; 671 uint8_t bytes[3]; 672 }; 673 674 enum ses_ctrl_scsi_port_or_xcvr_field_data { 675 SES_CTRL_SCSI_PORT_OR_XCVR_RQST_IDENT_BYTE = 0, 676 SES_CTRL_SCSI_PORT_OR_XCVR_RQST_IDENT_MASK = 0x80, 677 SES_CTRL_SCSI_PORT_OR_XCVR_RQST_IDENT_SHIFT = 7, 678 679 SES_CTRL_SCSI_PORT_OR_XCVR_RQST_FAIL_BYTE = 0, 680 SES_CTRL_SCSI_PORT_OR_XCVR_RQST_FAIL_MASK = 0x40, 681 SES_CTRL_SCSI_PORT_OR_XCVR_RQST_FAIL_SHIFT = 6, 682 683 SES_CTRL_SCSI_PORT_OR_XCVR_DISABLE_BYTE = 2, 684 SES_CTRL_SCSI_PORT_OR_XCVR_DISABLE_MASK = 0x10, 685 SES_CTRL_SCSI_PORT_OR_XCVR_DISABLE_SHIFT = 4 686 }; 687 688 #define GEN_SES_CTRL_SCSI_PORT_OR_XCVR_ACCESSORS(LCASE, UCASE) \ 689 GEN_ACCESSORS(ses_ctrl_scsi_port_or_xcvr, SES_CTRL_SCSI_PORT_OR_XCVR,\ 690 LCASE, UCASE) 691 GEN_SES_CTRL_SCSI_PORT_OR_XCVR_ACCESSORS(rqst_ident, RQST_IDENT) 692 GEN_SES_CTRL_SCSI_PORT_OR_XCVR_ACCESSORS(disable, DISABLE) 693 GEN_SES_CTRL_SCSI_PORT_OR_XCVR_ACCESSORS(rqst_fail, RQST_FAIL) 694 #undef GEN_SES_CTRL_SCSI_PORT_OR_XCVR_ACCESSORS 695 696 /*------------------------- Language Control Element -------------------------*/ 697 struct ses_ctrl_language { 698 struct ses_ctrl_common common; 699 uint8_t bytes[1]; 700 uint8_t language_code[2]; 701 }; 702 703 enum ses_ctrl_language_field_data { 704 SES_CTRL_LANGUAGE_RQST_IDENT_BYTE = 0, 705 SES_CTRL_LANGUAGE_RQST_IDENT_MASK = 0x80, 706 SES_CTRL_LANGUAGE_RQST_IDENT_SHIFT = 7 707 }; 708 709 #define GEN_SES_CTRL_LANGUAGE_ACCESSORS(LCASE, UCASE) \ 710 GEN_ACCESSORS(ses_ctrl_language, SES_CTRL_LANGUAGE, LCASE, UCASE) 711 GEN_SES_CTRL_LANGUAGE_ACCESSORS(rqst_ident, RQST_IDENT) 712 #undef GEN_SES_CTRL_LANGUAGE_ACCESSORS 713 714 /*-------------------- Communication Port Control Element --------------------*/ 715 struct ses_ctrl_comm_port { 716 struct ses_ctrl_common common; 717 uint8_t bytes[3]; 718 }; 719 720 enum ses_ctrl_comm_port_field_data { 721 SES_CTRL_COMM_PORT_RQST_IDENT_BYTE = 0, 722 SES_CTRL_COMM_PORT_RQST_IDENT_MASK = 0x80, 723 SES_CTRL_COMM_PORT_RQST_IDENT_SHIFT = 7, 724 725 SES_CTRL_COMM_PORT_RQST_FAIL_BYTE = 0, 726 SES_CTRL_COMM_PORT_RQST_FAIL_MASK = 0x40, 727 SES_CTRL_COMM_PORT_RQST_FAIL_SHIFT = 6, 728 729 SES_CTRL_COMM_PORT_DISABLE_BYTE = 2, 730 SES_CTRL_COMM_PORT_DISABLE_MASK = 0x01, 731 SES_CTRL_COMM_PORT_DISABLE_SHIFT = 0 732 }; 733 734 #define GEN_SES_CTRL_COMM_PORT_ACCESSORS(LCASE, UCASE) \ 735 GEN_ACCESSORS(ses_ctrl_comm_port, SES_CTRL_COMM_PORT, LCASE, UCASE) 736 GEN_SES_CTRL_COMM_PORT_ACCESSORS(rqst_ident, RQST_IDENT) 737 GEN_SES_CTRL_COMM_PORT_ACCESSORS(rqst_fail, RQST_FAIL) 738 GEN_SES_CTRL_COMM_PORT_ACCESSORS(disable, DISABLE) 739 #undef GEN_SES_CTRL_COMM_PORT_ACCESSORS 740 741 /*---------------------- Voltage Sensor Control Element ----------------------*/ 742 struct ses_ctrl_voltage_sensor { 743 struct ses_ctrl_common common; 744 uint8_t bytes[3]; 745 }; 746 747 enum ses_ctrl_voltage_sensor_field_data { 748 SES_CTRL_VOLTAGE_SENSOR_RQST_IDENT_BYTE = 0, 749 SES_CTRL_VOLTAGE_SENSOR_RQST_IDENT_MASK = 0x80, 750 SES_CTRL_VOLTAGE_SENSOR_RQST_IDENT_SHIFT = 7, 751 752 SES_CTRL_VOLTAGE_SENSOR_RQST_FAIL_BYTE = 0, 753 SES_CTRL_VOLTAGE_SENSOR_RQST_FAIL_MASK = 0x40, 754 SES_CTRL_VOLTAGE_SENSOR_RQST_FAIL_SHIFT = 6 755 }; 756 757 #define GEN_SES_CTRL_VOLTAGE_SENSOR_ACCESSORS(LCASE, UCASE) \ 758 GEN_ACCESSORS(ses_ctrl_voltage_sensor, SES_CTRL_VOLTAGE_SENSOR, \ 759 LCASE, UCASE) 760 GEN_SES_CTRL_VOLTAGE_SENSOR_ACCESSORS(rqst_ident, RQST_IDENT) 761 GEN_SES_CTRL_VOLTAGE_SENSOR_ACCESSORS(rqst_fail, RQST_FAIL) 762 #undef GEN_SES_CTRL_VOLTAGE_SENSOR_ACCESSORS 763 764 /*---------------------- Current Sensor Control Element ----------------------*/ 765 struct ses_ctrl_current_sensor { 766 struct ses_ctrl_common common; 767 uint8_t bytes[3]; 768 }; 769 770 enum ses_ctrl_current_sensor_field_data { 771 SES_CTRL_CURRENT_SENSOR_RQST_IDENT_BYTE = 0, 772 SES_CTRL_CURRENT_SENSOR_RQST_IDENT_MASK = 0x80, 773 SES_CTRL_CURRENT_SENSOR_RQST_IDENT_SHIFT = 7, 774 775 SES_CTRL_CURRENT_SENSOR_RQST_FAIL_BYTE = 0, 776 SES_CTRL_CURRENT_SENSOR_RQST_FAIL_MASK = 0x40, 777 SES_CTRL_CURRENT_SENSOR_RQST_FAIL_SHIFT = 6 778 }; 779 780 #define GEN_SES_CTRL_CURRENT_SENSOR_ACCESSORS(LCASE, UCASE) \ 781 GEN_ACCESSORS(ses_ctrl_current_sensor, SES_CTRL_CURRENT_SENSOR, \ 782 LCASE, UCASE) 783 GEN_SES_CTRL_CURRENT_SENSOR_ACCESSORS(rqst_ident, RQST_IDENT) 784 GEN_SES_CTRL_CURRENT_SENSOR_ACCESSORS(rqst_fail, RQST_FAIL) 785 #undef GEN_SES_CTRL_CURRENT_SENSOR_ACCESSORS 786 787 /*--------------------- SCSI Target Port Control Element ---------------------*/ 788 struct ses_ctrl_target_port { 789 struct ses_ctrl_common common; 790 uint8_t bytes[3]; 791 }; 792 793 enum ses_ctrl_scsi_target_port_field_data { 794 SES_CTRL_TARGET_PORT_RQST_IDENT_BYTE = 0, 795 SES_CTRL_TARGET_PORT_RQST_IDENT_MASK = 0x80, 796 SES_CTRL_TARGET_PORT_RQST_IDENT_SHIFT = 7, 797 798 SES_CTRL_TARGET_PORT_RQST_FAIL_BYTE = 0, 799 SES_CTRL_TARGET_PORT_RQST_FAIL_MASK = 0x40, 800 SES_CTRL_TARGET_PORT_RQST_FAIL_SHIFT = 6, 801 802 SES_CTRL_TARGET_PORT_ENABLE_BYTE = 2, 803 SES_CTRL_TARGET_PORT_ENABLE_MASK = 0x01, 804 SES_CTRL_TARGET_PORT_ENABLE_SHIFT = 0 805 }; 806 807 #define GEN_SES_CTRL_TARGET_PORT_ACCESSORS(LCASE, UCASE) \ 808 GEN_ACCESSORS(ses_ctrl_target_port, SES_CTRL_TARGET_PORT, LCASE, UCASE) 809 GEN_SES_CTRL_TARGET_PORT_ACCESSORS(rqst_ident, RQST_IDENT) 810 GEN_SES_CTRL_TARGET_PORT_ACCESSORS(rqst_fail, RQST_FAIL) 811 GEN_SES_CTRL_TARGET_PORT_ACCESSORS(enable, ENABLE) 812 #undef GEN_SES_CTRL_TARGET_PORT_ACCESSORS 813 814 /*-------------------- SCSI Initiator Port Control Element -------------------*/ 815 struct ses_ctrl_initiator_port { 816 struct ses_ctrl_common common; 817 uint8_t bytes[3]; 818 }; 819 820 enum ses_ctrl_initiator_port_field_data { 821 SES_CTRL_INITIATOR_PORT_RQST_IDENT_BYTE = 0, 822 SES_CTRL_INITIATOR_PORT_RQST_IDENT_MASK = 0x80, 823 SES_CTRL_INITIATOR_PORT_RQST_IDENT_SHIFT = 7, 824 825 SES_CTRL_INITIATOR_PORT_RQST_FAIL_BYTE = 0, 826 SES_CTRL_INITIATOR_PORT_RQST_FAIL_MASK = 0x40, 827 SES_CTRL_INITIATOR_PORT_RQST_FAIL_SHIFT = 6, 828 829 SES_CTRL_INITIATOR_PORT_ENABLE_BYTE = 2, 830 SES_CTRL_INITIATOR_PORT_ENABLE_MASK = 0x01, 831 SES_CTRL_INITIATOR_PORT_ENABLE_SHIFT = 0 832 }; 833 834 #define GEN_SES_CTRL_INITIATOR_PORT_ACCESSORS(LCASE, UCASE) \ 835 GEN_ACCESSORS(ses_ctrl_initiator_port, SES_CTRL_INITIATOR_PORT, \ 836 LCASE, UCASE) 837 GEN_SES_CTRL_INITIATOR_PORT_ACCESSORS(rqst_ident, RQST_IDENT) 838 GEN_SES_CTRL_INITIATOR_PORT_ACCESSORS(rqst_fail, RQST_FAIL) 839 GEN_SES_CTRL_INITIATOR_PORT_ACCESSORS(enable, ENABLE) 840 #undef GEN_SES_CTRL_INITIATOR_PORT_ACCESSORS 841 842 /*-------------------- Simple Subenclosure Control Element -------------------*/ 843 struct ses_ctrl_simple_subenc { 844 struct ses_ctrl_common common; 845 uint8_t bytes[3]; 846 }; 847 848 enum ses_ctrl_simple_subenc_field_data { 849 SES_CTRL_SIMPlE_SUBSES_RQST_IDENT_BYTE = 0, 850 SES_CTRL_SIMPlE_SUBSES_RQST_IDENT_MASK = 0x80, 851 SES_CTRL_SIMPlE_SUBSES_RQST_IDENT_SHIFT = 7, 852 853 SES_CTRL_SIMPlE_SUBSES_RQST_FAIL_BYTE = 0, 854 SES_CTRL_SIMPlE_SUBSES_RQST_FAIL_MASK = 0x40, 855 SES_CTRL_SIMPlE_SUBSES_RQST_FAIL_SHIFT = 6 856 }; 857 858 #define GEN_SES_CTRL_SIMPlE_SUBSES_ACCESSORS(LCASE, UCASE) \ 859 GEN_ACCESSORS(ses_ctrl_simple_subenc, SES_CTRL_SIMPlE_SUBSES, \ 860 LCASE, UCASE) 861 GEN_SES_CTRL_SIMPlE_SUBSES_ACCESSORS(rqst_ident, RQST_IDENT) 862 GEN_SES_CTRL_SIMPlE_SUBSES_ACCESSORS(rqst_fail, RQST_FAIL) 863 #undef GEN_SES_CTRL_SIMPlE_SUBSES_ACCESSORS 864 865 /*----------------------- SAS Expander Control Element -----------------------*/ 866 struct ses_ctrl_sas_expander { 867 struct ses_ctrl_common common; 868 uint8_t bytes[3]; 869 }; 870 871 enum ses_ctrl_sas_expander_field_data { 872 SES_CTRL_SAS_EXPANDER_RQST_IDENT_BYTE = 0, 873 SES_CTRL_SAS_EXPANDER_RQST_IDENT_MASK = 0x80, 874 SES_CTRL_SAS_EXPANDER_RQST_IDENT_SHIFT = 7, 875 876 SES_CTRL_SAS_EXPANDER_RQST_FAIL_BYTE = 0, 877 SES_CTRL_SAS_EXPANDER_RQST_FAIL_MASK = 0x40, 878 SES_CTRL_SAS_EXPANDER_RQST_FAIL_SHIFT = 6 879 }; 880 881 #define GEN_SES_CTRL_SAS_EXPANDER_ACCESSORS(LCASE, UCASE) \ 882 GEN_ACCESSORS(ses_ctrl_sas_expander, SES_CTRL_SAS_EXPANDER, LCASE, UCASE) 883 GEN_SES_CTRL_SAS_EXPANDER_ACCESSORS(rqst_ident, RQST_IDENT) 884 GEN_SES_CTRL_SAS_EXPANDER_ACCESSORS(rqst_fail, RQST_FAIL) 885 #undef GEN_SES_CTRL_SAS_EXPANDER_ACCESSORS 886 887 /*----------------------- SAS Connector Control Element ----------------------*/ 888 struct ses_ctrl_sas_connector { 889 struct ses_ctrl_common common; 890 uint8_t bytes[3]; 891 }; 892 893 enum ses_ctrl_sas_connector_field_data { 894 SES_CTRL_SAS_CONNECTOR_RQST_IDENT_BYTE = 0, 895 SES_CTRL_SAS_CONNECTOR_RQST_IDENT_MASK = 0x80, 896 SES_CTRL_SAS_CONNECTOR_RQST_IDENT_SHIFT = 7, 897 898 SES_CTRL_SAS_CONNECTOR_RQST_FAIL_BYTE = 2, 899 SES_CTRL_SAS_CONNECTOR_RQST_FAIL_MASK = 0x40, 900 SES_CTRL_SAS_CONNECTOR_RQST_FAIL_SHIFT = 6 901 }; 902 903 #define GEN_SES_CTRL_SAS_CONNECTOR_ACCESSORS(LCASE, UCASE) \ 904 GEN_ACCESSORS(ses_ctrl_sas_connector, SES_CTRL_SAS_CONNECTOR, \ 905 LCASE, UCASE) 906 GEN_SES_CTRL_SAS_CONNECTOR_ACCESSORS(rqst_ident, RQST_IDENT) 907 GEN_SES_CTRL_SAS_CONNECTOR_ACCESSORS(rqst_fail, RQST_FAIL) 908 #undef GEN_SES_CTRL_SAS_CONNECTOR_ACCESSORS 909 910 /*------------------------- Universal Control Element ------------------------*/ 911 union ses_ctrl_element { 912 struct ses_ctrl_common common; 913 struct ses_ctrl_dev_slot dev_slot; 914 struct ses_ctrl_array_dev_slot array_dev_slot; 915 struct ses_ctrl_power_supply power_supply; 916 struct ses_ctrl_cooling cooling; 917 struct ses_ctrl_temp_sensor temp_sensor; 918 struct ses_ctrl_door_lock door_lock; 919 struct ses_ctrl_audible_alarm audible_alarm; 920 struct ses_ctrl_ecc_electronics ecc_electronics; 921 struct ses_ctrl_scc_electronics scc_electronics; 922 struct ses_ctrl_nv_cache nv_cache; 923 struct ses_ctrl_invalid_op_reason invalid_op_reason; 924 struct ses_ctrl_ups ups; 925 struct ses_ctrl_display display; 926 struct ses_ctrl_key_pad_entry key_pad_entry; 927 struct ses_ctrl_scsi_port_or_xcvr scsi_port_or_xcvr; 928 struct ses_ctrl_language language; 929 struct ses_ctrl_comm_port comm_port; 930 struct ses_ctrl_voltage_sensor voltage_sensor; 931 struct ses_ctrl_current_sensor current_sensor; 932 struct ses_ctrl_target_port target_port; 933 struct ses_ctrl_initiator_port initiator_port; 934 struct ses_ctrl_simple_subenc simple_subenc; 935 struct ses_ctrl_sas_expander sas_expander; 936 struct ses_ctrl_sas_connector sas_connector; 937 }; 938 939 /*--------------------- SCSI SES Control Diagnostic Page ---------------------*/ 940 struct ses_ctrl_page { 941 struct ses_page_hdr hdr; 942 union ses_ctrl_element elements[]; 943 }; 944 945 enum ses_ctrl_page_field_data { 946 SES_CTRL_PAGE_INFO_MASK = 0x08, 947 SES_CTRL_PAGE_INFO_SHIFT = 3, 948 949 SES_CTRL_PAGE_NON_CRIT_MASK = 0x04, 950 SES_CTRL_PAGE_NON_CRIT_SHIFT = 2, 951 952 SES_CTRL_PAGE_CRIT_MASK = 0x02, 953 SES_CTRL_PAGE_CRIT_SHIFT = 1, 954 955 SES_CTRL_PAGE_UNRECOV_MASK = 0x01, 956 SES_CTRL_PAGE_UNRECOV_SHIFT = 0 957 }; 958 959 #define GEN_SES_CTRL_PAGE_ACCESSORS(LCASE, UCASE) \ 960 GEN_HDR_ACCESSORS(ses_ctrl_page, SES_CTRL_PAGE, LCASE, UCASE) 961 962 GEN_SES_CTRL_PAGE_ACCESSORS(info, INFO) 963 GEN_SES_CTRL_PAGE_ACCESSORS(non_crit, NON_CRIT) 964 GEN_SES_CTRL_PAGE_ACCESSORS(crit, CRIT) 965 GEN_SES_CTRL_PAGE_ACCESSORS(unrecov, UNRECOV) 966 #undef GEN_SES_CTRL_PAGE_ACCESSORS 967 968 /*================= SCSI SES Status Diagnostic Page Structures ===============*/ 969 struct ses_status_common { 970 uint8_t bytes[1]; 971 }; 972 973 enum ses_status_common_field_data { 974 SES_STATUS_COMMON_PRDFAIL_BYTE = 0, 975 SES_STATUS_COMMON_PRDFAIL_MASK = 0x40, 976 SES_STATUS_COMMON_PRDFAIL_SHIFT = 6, 977 978 SES_STATUS_COMMON_DISABLED_BYTE = 0, 979 SES_STATUS_COMMON_DISABLED_MASK = 0x20, 980 SES_STATUS_COMMON_DISABLED_SHIFT = 5, 981 982 SES_STATUS_COMMON_SWAP_BYTE = 0, 983 SES_STATUS_COMMON_SWAP_MASK = 0x10, 984 SES_STATUS_COMMON_SWAP_SHIFT = 4, 985 986 SES_STATUS_COMMON_ELEMENT_STATUS_CODE_BYTE = 0, 987 SES_STATUS_COMMON_ELEMENT_STATUS_CODE_MASK = 0x0F, 988 SES_STATUS_COMMON_ELEMENT_STATUS_CODE_SHIFT = 0 989 }; 990 991 #define GEN_SES_STATUS_COMMON_ACCESSORS(LCASE, UCASE) \ 992 GEN_GETTER(ses_status_common, SES_STATUS_COMMON, LCASE, UCASE) 993 994 GEN_SES_STATUS_COMMON_ACCESSORS(prdfail, PRDFAIL) 995 GEN_SES_STATUS_COMMON_ACCESSORS(disabled, DISABLED) 996 GEN_SES_STATUS_COMMON_ACCESSORS(swap, SWAP) 997 GEN_SES_STATUS_COMMON_ACCESSORS(element_status_code, ELEMENT_STATUS_CODE) 998 #undef GEN_SES_STATUS_COMMON_ACCESSORS 999 1000 /*------------------------- Device Slot Status Element -----------------------*/ 1001 struct ses_status_dev_slot { 1002 struct ses_status_common common; 1003 uint8_t slot_address; 1004 uint8_t bytes[2]; 1005 }; 1006 1007 enum ses_status_dev_slot_field_data { 1008 SES_STATUS_DEV_SLOT_APP_CLIENT_BYPED_A_BYTE = 0, 1009 SES_STATUS_DEV_SLOT_APP_CLIENT_BYPED_A_MASK = 0x80, 1010 SES_STATUS_DEV_SLOT_APP_CLIENT_BYPED_A_SHIFT = 7, 1011 1012 SES_STATUS_DEV_SLOT_DO_NOT_REMOVE_BYTE = 0, 1013 SES_STATUS_DEV_SLOT_DO_NOT_REMOVE_MASK = 0x40, 1014 SES_STATUS_DEV_SLOT_DO_NOT_REMOVE_SHIFT = 6, 1015 1016 SES_STATUS_DEV_SLOT_ENCLOSURE_BYPED_A_BYTE = 0, 1017 SES_STATUS_DEV_SLOT_ENCLOSURE_BYPED_A_MASK = 0x20, 1018 SES_STATUS_DEV_SLOT_ENCLOSURE_BYPED_A_SHIFT = 5, 1019 1020 SES_STATUS_DEV_SLOT_ENCLOSURE_BYPED_B_BYTE = 0, 1021 SES_STATUS_DEV_SLOT_ENCLOSURE_BYPED_B_MASK = 0x10, 1022 SES_STATUS_DEV_SLOT_ENCLOSURE_BYPED_B_SHIFT = 4, 1023 1024 SES_STATUS_DEV_SLOT_INSERT_READY_BYTE = 0, 1025 SES_STATUS_DEV_SLOT_INSERT_READY_MASK = 0x08, 1026 SES_STATUS_DEV_SLOT_INSERT_READY_SHIFT = 3, 1027 1028 SES_STATUS_DEV_SLOT_REMOVE_BYTE = 0, 1029 SES_STATUS_DEV_SLOT_REMOVE_MASK = 0x04, 1030 SES_STATUS_DEV_SLOT_REMOVE_SHIFT = 2, 1031 1032 SES_STATUS_DEV_SLOT_IDENT_BYTE = 0, 1033 SES_STATUS_DEV_SLOT_IDENT_MASK = 0x02, 1034 SES_STATUS_DEV_SLOT_IDENT_SHIFT = 1, 1035 1036 SES_STATUS_DEV_SLOT_REPORT_BYTE = 0, 1037 SES_STATUS_DEV_SLOT_REPORT_MASK = 0x01, 1038 SES_STATUS_DEV_SLOT_REPORT_SHIFT = 0, 1039 1040 SES_STATUS_DEV_SLOT_APP_CLIENT_BYPED_B_BYTE = 1, 1041 SES_STATUS_DEV_SLOT_APP_CLIENT_BYPED_B_MASK = 0x80, 1042 SES_STATUS_DEV_SLOT_APP_CLIENT_BYPED_B_SHIFT = 7, 1043 1044 SES_STATUS_DEV_SLOT_FAULT_SENSED_BYTE = 1, 1045 SES_STATUS_DEV_SLOT_FAULT_SENSED_MASK = 0x40, 1046 SES_STATUS_DEV_SLOT_FAULT_SENSED_SHIFT = 6, 1047 1048 SES_STATUS_DEV_SLOT_FAULT_REQUESTED_BYTE = 1, 1049 SES_STATUS_DEV_SLOT_FAULT_REQUESTED_MASK = 0x20, 1050 SES_STATUS_DEV_SLOT_FAULT_REQUESTED_SHIFT = 5, 1051 1052 SES_STATUS_DEV_SLOT_DEVICE_OFF_BYTE = 1, 1053 SES_STATUS_DEV_SLOT_DEVICE_OFF_MASK = 0x10, 1054 SES_STATUS_DEV_SLOT_DEVICE_OFF_SHIFT = 4, 1055 1056 SES_STATUS_DEV_SLOT_BYPED_A_BYTE = 1, 1057 SES_STATUS_DEV_SLOT_BYPED_A_MASK = 0x08, 1058 SES_STATUS_DEV_SLOT_BYPED_A_SHIFT = 3, 1059 1060 SES_STATUS_DEV_SLOT_BYPED_B_BYTE = 1, 1061 SES_STATUS_DEV_SLOT_BYPED_B_MASK = 0x04, 1062 SES_STATUS_DEV_SLOT_BYPED_B_SHIFT = 2, 1063 1064 SES_STATUS_DEV_SLOT_DEVICE_BYPED_A_BYTE = 1, 1065 SES_STATUS_DEV_SLOT_DEVICE_BYPED_A_MASK = 0x02, 1066 SES_STATUS_DEV_SLOT_DEVICE_BYPED_A_SHIFT = 1, 1067 1068 SES_STATUS_DEV_SLOT_DEVICE_BYPED_B_BYTE = 1, 1069 SES_STATUS_DEV_SLOT_DEVICE_BYPED_B_MASK = 0x01, 1070 SES_STATUS_DEV_SLOT_DEVICE_BYPED_B_SHIFT = 0 1071 }; 1072 #define GEN_SES_STATUS_DEV_SLOT_ACCESSORS(LCASE, UCASE) \ 1073 GEN_GETTER(ses_status_dev_slot, SES_STATUS_DEV_SLOT, LCASE, UCASE) 1074 1075 GEN_SES_STATUS_DEV_SLOT_ACCESSORS(app_client_byped_a, APP_CLIENT_BYPED_A) 1076 GEN_SES_STATUS_DEV_SLOT_ACCESSORS(do_not_remove, DO_NOT_REMOVE) 1077 GEN_SES_STATUS_DEV_SLOT_ACCESSORS(enclosure_byped_a, ENCLOSURE_BYPED_A) 1078 GEN_SES_STATUS_DEV_SLOT_ACCESSORS(enclosure_byped_b, ENCLOSURE_BYPED_B) 1079 GEN_SES_STATUS_DEV_SLOT_ACCESSORS(insert_ready, INSERT_READY) 1080 GEN_SES_STATUS_DEV_SLOT_ACCESSORS(remove, REMOVE) 1081 GEN_SES_STATUS_DEV_SLOT_ACCESSORS(ident, IDENT) 1082 GEN_SES_STATUS_DEV_SLOT_ACCESSORS(report, REPORT) 1083 GEN_SES_STATUS_DEV_SLOT_ACCESSORS(app_client_byped_b, APP_CLIENT_BYPED_B) 1084 GEN_SES_STATUS_DEV_SLOT_ACCESSORS(fault_sensed, FAULT_SENSED) 1085 GEN_SES_STATUS_DEV_SLOT_ACCESSORS(fault_requested, FAULT_REQUESTED) 1086 GEN_SES_STATUS_DEV_SLOT_ACCESSORS(device_off, DEVICE_OFF) 1087 GEN_SES_STATUS_DEV_SLOT_ACCESSORS(byped_a, BYPED_A) 1088 GEN_SES_STATUS_DEV_SLOT_ACCESSORS(byped_b, BYPED_B) 1089 GEN_SES_STATUS_DEV_SLOT_ACCESSORS(device_byped_a, DEVICE_BYPED_A) 1090 GEN_SES_STATUS_DEV_SLOT_ACCESSORS(device_byped_b, DEVICE_BYPED_B) 1091 #undef GEN_SES_STATUS_DEV_SLOT_ACCESSORS 1092 1093 /*---------------------- Array Device Slot Status Element --------------------*/ 1094 struct ses_status_array_dev_slot { 1095 struct ses_status_common common; 1096 uint8_t bytes[3]; 1097 }; 1098 1099 enum ses_status_array_dev_slot_field_data { 1100 SES_STATUS_ARRAY_DEV_SLOT_OK_BYTE = 0, 1101 SES_STATUS_ARRAY_DEV_SLOT_OK_MASK = 0x80, 1102 SES_STATUS_ARRAY_DEV_SLOT_OK_SHIFT = 7, 1103 1104 SES_STATUS_ARRAY_DEV_SLOT_RSVD_DEVICE_BYTE = 0, 1105 SES_STATUS_ARRAY_DEV_SLOT_RSVD_DEVICE_MASK = 0x40, 1106 SES_STATUS_ARRAY_DEV_SLOT_RSVD_DEVICE_SHIFT = 6, 1107 1108 SES_STATUS_ARRAY_DEV_SLOT_HOT_SPARE_BYTE = 0, 1109 SES_STATUS_ARRAY_DEV_SLOT_HOT_SPARE_MASK = 0x20, 1110 SES_STATUS_ARRAY_DEV_SLOT_HOT_SPARE_SHIFT = 5, 1111 1112 SES_STATUS_ARRAY_DEV_SLOT_CONS_CHECK_BYTE = 0, 1113 SES_STATUS_ARRAY_DEV_SLOT_CONS_CHECK_MASK = 0x10, 1114 SES_STATUS_ARRAY_DEV_SLOT_CONS_CHECK_SHIFT = 4, 1115 1116 SES_STATUS_ARRAY_DEV_SLOT_IN_CRIT_ARRAY_BYTE = 0, 1117 SES_STATUS_ARRAY_DEV_SLOT_IN_CRIT_ARRAY_MASK = 0x08, 1118 SES_STATUS_ARRAY_DEV_SLOT_IN_CRIT_ARRAY_SHIFT = 3, 1119 1120 SES_STATUS_ARRAY_DEV_SLOT_IN_FAILED_ARRAY_BYTE = 0, 1121 SES_STATUS_ARRAY_DEV_SLOT_IN_FAILED_ARRAY_MASK = 0x04, 1122 SES_STATUS_ARRAY_DEV_SLOT_IN_FAILED_ARRAY_SHIFT = 2, 1123 1124 SES_STATUS_ARRAY_DEV_SLOT_REBUILD_REMAP_BYTE = 0, 1125 SES_STATUS_ARRAY_DEV_SLOT_REBUILD_REMAP_MASK = 0x02, 1126 SES_STATUS_ARRAY_DEV_SLOT_REBUILD_REMAP_SHIFT = 1, 1127 1128 SES_STATUS_ARRAY_DEV_SLOT_REBUILD_REMAP_ABORT_BYTE = 0, 1129 SES_STATUS_ARRAY_DEV_SLOT_REBUILD_REMAP_ABORT_MASK = 0x01, 1130 SES_STATUS_ARRAY_DEV_SLOT_REBUILD_REMAP_ABORT_SHIFT = 0 1131 1132 /* 1133 * The remaining fields are identical to the device 1134 * slot element type. Access them through the device slot 1135 * element type and its accessors. 1136 */ 1137 }; 1138 #define GEN_SES_STATUS_ARRAY_DEV_SLOT_ACCESSORS(LCASE, UCASE) \ 1139 GEN_GETTER(ses_status_array_dev_slot, SES_STATUS_ARRAY_DEV_SLOT, \ 1140 LCASE, UCASE) 1141 GEN_SES_STATUS_ARRAY_DEV_SLOT_ACCESSORS(ok, OK) 1142 GEN_SES_STATUS_ARRAY_DEV_SLOT_ACCESSORS(rsvd_device, RSVD_DEVICE) 1143 GEN_SES_STATUS_ARRAY_DEV_SLOT_ACCESSORS(hot_spare, HOT_SPARE) 1144 GEN_SES_STATUS_ARRAY_DEV_SLOT_ACCESSORS(cons_check, CONS_CHECK) 1145 GEN_SES_STATUS_ARRAY_DEV_SLOT_ACCESSORS(in_crit_array, IN_CRIT_ARRAY) 1146 GEN_SES_STATUS_ARRAY_DEV_SLOT_ACCESSORS(in_failed_array, IN_FAILED_ARRAY) 1147 GEN_SES_STATUS_ARRAY_DEV_SLOT_ACCESSORS(rebuild_remap, REBUILD_REMAP) 1148 GEN_SES_STATUS_ARRAY_DEV_SLOT_ACCESSORS(rebuild_remap_abort, 1149 REBUILD_REMAP_ABORT) 1150 #undef GEN_SES_STATUS_ARRAY_DEV_SLOT_ACCESSORS 1151 1152 /*----------------------- Power Supply Status Element ------------------------*/ 1153 struct ses_status_power_supply { 1154 struct ses_status_common common; 1155 uint8_t bytes[3]; 1156 }; 1157 1158 enum ses_status_power_supply_field_data { 1159 SES_STATUS_POWER_SUPPLY_IDENT_BYTE = 0, 1160 SES_STATUS_POWER_SUPPLY_IDENT_MASK = 0x80, 1161 SES_STATUS_POWER_SUPPLY_IDENT_SHIFT = 7, 1162 1163 SES_STATUS_POWER_SUPPLY_DC_OVER_VOLTAGE_BYTE = 1, 1164 SES_STATUS_POWER_SUPPLY_DC_OVER_VOLTAGE_MASK = 0x08, 1165 SES_STATUS_POWER_SUPPLY_DC_OVER_VOLTAGE_SHIFT = 3, 1166 1167 SES_STATUS_POWER_SUPPLY_DC_UNDER_VOLTAGE_BYTE = 1, 1168 SES_STATUS_POWER_SUPPLY_DC_UNDER_VOLTAGE_MASK = 0x04, 1169 SES_STATUS_POWER_SUPPLY_DC_UNDER_VOLTAGE_SHIFT = 2, 1170 1171 SES_STATUS_POWER_SUPPLY_DC_OVER_CURRENT_BYTE = 1, 1172 SES_STATUS_POWER_SUPPLY_DC_OVER_CURRENT_MASK = 0x02, 1173 SES_STATUS_POWER_SUPPLY_DC_OVER_CURRENT_SHIFT = 1, 1174 1175 SES_STATUS_POWER_SUPPLY_HOT_SWAP_BYTE = 2, 1176 SES_STATUS_POWER_SUPPLY_HOT_SWAP_MASK = 0x80, 1177 SES_STATUS_POWER_SUPPLY_HOT_SWAP_SHIFT = 7, 1178 1179 SES_STATUS_POWER_SUPPLY_FAIL_BYTE = 2, 1180 SES_STATUS_POWER_SUPPLY_FAIL_MASK = 0x40, 1181 SES_STATUS_POWER_SUPPLY_FAIL_SHIFT = 6, 1182 1183 SES_STATUS_POWER_SUPPLY_REQUESTED_ON_BYTE = 2, 1184 SES_STATUS_POWER_SUPPLY_REQUESTED_ON_MASK = 0x20, 1185 SES_STATUS_POWER_SUPPLY_REQUESTED_ON_SHIFT = 5, 1186 1187 SES_STATUS_POWER_SUPPLY_OFF_BYTE = 2, 1188 SES_STATUS_POWER_SUPPLY_OFF_MASK = 0x10, 1189 SES_STATUS_POWER_SUPPLY_OFF_SHIFT = 4, 1190 1191 SES_STATUS_POWER_SUPPLY_OVERTMP_FAIL_BYTE = 2, 1192 SES_STATUS_POWER_SUPPLY_OVERTMP_FAIL_MASK = 0x08, 1193 SES_STATUS_POWER_SUPPLY_OVERTMP_FAIL_SHIFT = 3, 1194 1195 SES_STATUS_POWER_SUPPLY_TEMP_WARN_BYTE = 2, 1196 SES_STATUS_POWER_SUPPLY_TEMP_WARN_MASK = 0x04, 1197 SES_STATUS_POWER_SUPPLY_TEMP_WARN_SHIFT = 2, 1198 1199 SES_STATUS_POWER_SUPPLY_AC_FAIL_BYTE = 2, 1200 SES_STATUS_POWER_SUPPLY_AC_FAIL_MASK = 0x02, 1201 SES_STATUS_POWER_SUPPLY_AC_FAIL_SHIFT = 1, 1202 1203 SES_STATUS_POWER_SUPPLY_DC_FAIL_BYTE = 2, 1204 SES_STATUS_POWER_SUPPLY_DC_FAIL_MASK = 0x01, 1205 SES_STATUS_POWER_SUPPLY_DC_FAIL_SHIFT = 0 1206 }; 1207 1208 #define GEN_SES_STATUS_POWER_SUPPLY_ACCESSORS(LCASE, UCASE) \ 1209 GEN_GETTER(ses_status_power_supply, SES_STATUS_POWER_SUPPLY, LCASE, UCASE) 1210 GEN_SES_STATUS_POWER_SUPPLY_ACCESSORS(ident, IDENT) 1211 GEN_SES_STATUS_POWER_SUPPLY_ACCESSORS(dc_over_voltage, DC_OVER_VOLTAGE) 1212 GEN_SES_STATUS_POWER_SUPPLY_ACCESSORS(dc_under_voltage, DC_UNDER_VOLTAGE) 1213 GEN_SES_STATUS_POWER_SUPPLY_ACCESSORS(dc_over_current, DC_OVER_CURRENT) 1214 GEN_SES_STATUS_POWER_SUPPLY_ACCESSORS(hot_swap, HOT_SWAP) 1215 GEN_SES_STATUS_POWER_SUPPLY_ACCESSORS(fail, FAIL) 1216 GEN_SES_STATUS_POWER_SUPPLY_ACCESSORS(requested_on, REQUESTED_ON) 1217 GEN_SES_STATUS_POWER_SUPPLY_ACCESSORS(off, OFF) 1218 GEN_SES_STATUS_POWER_SUPPLY_ACCESSORS(overtmp_fail, OVERTMP_FAIL) 1219 GEN_SES_STATUS_POWER_SUPPLY_ACCESSORS(temp_warn, TEMP_WARN) 1220 GEN_SES_STATUS_POWER_SUPPLY_ACCESSORS(ac_fail, AC_FAIL) 1221 GEN_SES_STATUS_POWER_SUPPLY_ACCESSORS(dc_fail, DC_FAIL) 1222 #undef GEN_SES_STATUS_POWER_SUPPLY_ACCESSORS 1223 1224 /*-------------------------- Cooling Status Element --------------------------*/ 1225 struct ses_status_cooling { 1226 struct ses_status_common common; 1227 uint8_t bytes[3]; 1228 }; 1229 1230 enum ses_status_cooling_field_data { 1231 SES_STATUS_COOLING_IDENT_BYTE = 0, 1232 SES_STATUS_COOLING_IDENT_MASK = 0x80, 1233 SES_STATUS_COOLING_IDENT_SHIFT = 7, 1234 1235 SES_STATUS_COOLING_ACTUAL_FAN_SPEED_MSB_BYTE = 0, 1236 SES_STATUS_COOLING_ACTUAL_FAN_SPEED_MSB_MASK = 0x07, 1237 SES_STATUS_COOLING_ACTUAL_FAN_SPEED_MSB_SHIFT = 0, 1238 1239 SES_STATUS_COOLING_ACTUAL_FAN_SPEED_LSB_BYTE = 1, 1240 SES_STATUS_COOLING_ACTUAL_FAN_SPEED_LSB_MASK = 0xFF, 1241 SES_STATUS_COOLING_ACTUAL_FAN_SPEED_LSB_SHIFT = 0, 1242 1243 SES_STATUS_COOLING_HOT_SWAP_BYTE = 2, 1244 SES_STATUS_COOLING_HOT_SWAP_MASK = 0x40, 1245 SES_STATUS_COOLING_HOT_SWAP_SHIFT = 6, 1246 1247 SES_STATUS_COOLING_FAIL_BYTE = 2, 1248 SES_STATUS_COOLING_FAIL_MASK = 0x40, 1249 SES_STATUS_COOLING_FAIL_SHIFT = 6, 1250 1251 SES_STATUS_COOLING_REQUESTED_ON_BYTE = 2, 1252 SES_STATUS_COOLING_REQUESTED_ON_MASK = 0x20, 1253 SES_STATUS_COOLING_REQUESTED_ON_SHIFT = 5, 1254 1255 SES_STATUS_COOLING_OFF_BYTE = 2, 1256 SES_STATUS_COOLING_OFF_MASK = 0x20, 1257 SES_STATUS_COOLING_OFF_SHIFT = 5, 1258 1259 SES_STATUS_COOLING_ACTUAL_SPEED_CODE_BYTE = 2, 1260 SES_STATUS_COOLING_ACTUAL_SPEED_CODE_MASK = 0x07, 1261 SES_STATUS_COOLING_ACTUAL_SPEED_CODE_SHIFT = 2, 1262 SES_STATUS_COOLING_ACTUAL_SPEED_CODE_STOPPED = 0x00, 1263 SES_STATUS_COOLING_ACTUAL_SPEED_CODE_LOWEST = 0x01, 1264 SES_STATUS_COOLING_ACTUAL_SPEED_CODE_HIGHEST = 0x07 1265 }; 1266 1267 #define GEN_SES_STATUS_COOLING_ACCESSORS(LCASE, UCASE) \ 1268 GEN_GETTER(ses_status_cooling, SES_STATUS_COOLING, LCASE, UCASE) 1269 GEN_SES_STATUS_COOLING_ACCESSORS(ident, IDENT) 1270 GEN_SES_STATUS_COOLING_ACCESSORS(actual_fan_speed_msb, ACTUAL_FAN_SPEED_MSB) 1271 GEN_SES_STATUS_COOLING_ACCESSORS(actual_fan_speed_lsb, ACTUAL_FAN_SPEED_LSB) 1272 GEN_SES_STATUS_COOLING_ACCESSORS(hot_swap, HOT_SWAP) 1273 GEN_SES_STATUS_COOLING_ACCESSORS(fail, FAIL) 1274 GEN_SES_STATUS_COOLING_ACCESSORS(requested_on, REQUESTED_ON) 1275 GEN_SES_STATUS_COOLING_ACCESSORS(off, OFF) 1276 GEN_SES_STATUS_COOLING_ACCESSORS(actual_speed_code, ACTUAL_SPEED_CODE) 1277 #undef GEN_SES_STATUS_COOLING_ACCESSORS 1278 1279 static inline int 1280 ses_status_cooling_get_actual_fan_speed(struct ses_status_cooling *elem) 1281 { 1282 return (ses_status_cooling_get_actual_fan_speed_msb(elem) << 8 1283 | ses_status_cooling_get_actual_fan_speed_lsb(elem)); 1284 } 1285 1286 /*-------------------- Temperature Sensor Status Element ---------------------*/ 1287 struct ses_status_temp_sensor { 1288 struct ses_status_common common; 1289 uint8_t bytes[3]; 1290 }; 1291 1292 enum ses_status_temp_sensor_field_data { 1293 SES_STATUS_TEMP_SENSOR_IDENT_BYTE = 0, 1294 SES_STATUS_TEMP_SENSOR_IDENT_MASK = 0x80, 1295 SES_STATUS_TEMP_SENSOR_IDENT_SHIFT = 7, 1296 1297 SES_STATUS_TEMP_SENSOR_FAIL_BYTE = 0, 1298 SES_STATUS_TEMP_SENSOR_FAIL_MASK = 0x40, 1299 SES_STATUS_TEMP_SENSOR_FAIL_SHIFT = 6, 1300 1301 SES_STATUS_TEMP_SENSOR_TEMPERATURE_BYTE = 1, 1302 SES_STATUS_TEMP_SENSOR_TEMPERATURE_MASK = 0xFF, 1303 SES_STATUS_TEMP_SENSOR_TEMPERATURE_SHIFT = 0, 1304 1305 SES_STATUS_TEMP_SENSOR_OT_FAILURE_BYTE = 2, 1306 SES_STATUS_TEMP_SENSOR_OT_FAILURE_MASK = 0x08, 1307 SES_STATUS_TEMP_SENSOR_OT_FAILURE_SHIFT = 3, 1308 1309 SES_STATUS_TEMP_SENSOR_OT_WARNING_BYTE = 2, 1310 SES_STATUS_TEMP_SENSOR_OT_WARNING_MASK = 0x04, 1311 SES_STATUS_TEMP_SENSOR_OT_WARNING_SHIFT = 2, 1312 1313 SES_STATUS_TEMP_SENSOR_UT_FAILURE_BYTE = 2, 1314 SES_STATUS_TEMP_SENSOR_UT_FAILURE_MASK = 0x02, 1315 SES_STATUS_TEMP_SENSOR_UT_FAILURE_SHIFT = 1, 1316 1317 SES_STATUS_TEMP_SENSOR_UT_WARNING_BYTE = 2, 1318 SES_STATUS_TEMP_SENSOR_UT_WARNING_MASK = 0x01, 1319 SES_STATUS_TEMP_SENSOR_UT_WARNING_SHIFT = 0 1320 }; 1321 1322 #define GEN_SES_STATUS_TEMP_SENSOR_ACCESSORS(LCASE, UCASE) \ 1323 GEN_GETTER(ses_status_temp_sensor, SES_STATUS_TEMP_SENSOR, LCASE, UCASE) 1324 GEN_SES_STATUS_TEMP_SENSOR_ACCESSORS(ident, IDENT) 1325 GEN_SES_STATUS_TEMP_SENSOR_ACCESSORS(fail, FAIL) 1326 GEN_SES_STATUS_TEMP_SENSOR_ACCESSORS(temperature, TEMPERATURE) 1327 GEN_SES_STATUS_TEMP_SENSOR_ACCESSORS(ot_failure, OT_FAILURE) 1328 GEN_SES_STATUS_TEMP_SENSOR_ACCESSORS(ot_warning, OT_WARNING) 1329 GEN_SES_STATUS_TEMP_SENSOR_ACCESSORS(ut_failure, UT_FAILURE) 1330 GEN_SES_STATUS_TEMP_SENSOR_ACCESSORS(ut_warning, UT_WARNING) 1331 #undef GEN_SES_STATUS_TEMP_SENSOR_ACCESSORS 1332 1333 /*------------------------- Door Lock Status Element -------------------------*/ 1334 struct ses_status_door_lock { 1335 struct ses_status_common common; 1336 uint8_t bytes[3]; 1337 }; 1338 1339 enum ses_status_door_lock_field_data { 1340 SES_STATUS_DOOR_LOCK_IDENT_BYTE = 0, 1341 SES_STATUS_DOOR_LOCK_IDENT_MASK = 0x80, 1342 SES_STATUS_DOOR_LOCK_IDENT_SHIFT = 7, 1343 1344 SES_STATUS_DOOR_LOCK_FAIL_BYTE = 0, 1345 SES_STATUS_DOOR_LOCK_FAIL_MASK = 0x40, 1346 SES_STATUS_DOOR_LOCK_FAIL_SHIFT = 6, 1347 1348 SES_STATUS_DOOR_LOCK_UNLOCKED_BYTE = 2, 1349 SES_STATUS_DOOR_LOCK_UNLOCKED_MASK = 0x01, 1350 SES_STATUS_DOOR_LOCK_UNLOCKED_SHIFT = 0 1351 }; 1352 1353 #define GEN_SES_STATUS_DOOR_LOCK_ACCESSORS(LCASE, UCASE) \ 1354 GEN_GETTER(ses_status_door_lock, SES_STATUS_DOOR_LOCK, LCASE, UCASE) 1355 GEN_SES_STATUS_DOOR_LOCK_ACCESSORS(ident, IDENT) 1356 GEN_SES_STATUS_DOOR_LOCK_ACCESSORS(fail, FAIL) 1357 GEN_SES_STATUS_DOOR_LOCK_ACCESSORS(unlocked, UNLOCKED) 1358 #undef GEN_SES_STATUS_DOOR_LOCK_ACCESSORS 1359 1360 /*----------------------- Audible Alarm Status Element -----------------------*/ 1361 struct ses_status_audible_alarm { 1362 struct ses_status_common common; 1363 uint8_t bytes[3]; 1364 }; 1365 1366 enum ses_status_audible_alarm_field_data { 1367 SES_STATUS_AUDIBLE_ALARM_IDENT_BYTE = 0, 1368 SES_STATUS_AUDIBLE_ALARM_IDENT_MASK = 0x80, 1369 SES_STATUS_AUDIBLE_ALARM_IDENT_SHIFT = 7, 1370 1371 SES_STATUS_AUDIBLE_ALARM_FAIL_BYTE = 0, 1372 SES_STATUS_AUDIBLE_ALARM_FAIL_MASK = 0x40, 1373 SES_STATUS_AUDIBLE_ALARM_FAIL_SHIFT = 6, 1374 1375 SES_STATUS_AUDIBLE_ALARM_RQST_MUTE_BYTE = 2, 1376 SES_STATUS_AUDIBLE_ALARM_RQST_MUTE_MASK = 0x80, 1377 SES_STATUS_AUDIBLE_ALARM_RQST_MUTE_SHIFT = 7, 1378 1379 SES_STATUS_AUDIBLE_ALARM_MUTED_BYTE = 2, 1380 SES_STATUS_AUDIBLE_ALARM_MUTED_MASK = 0x40, 1381 SES_STATUS_AUDIBLE_ALARM_MUTED_SHIFT = 6, 1382 1383 SES_STATUS_AUDIBLE_ALARM_REMIND_BYTE = 2, 1384 SES_STATUS_AUDIBLE_ALARM_REMIND_MASK = 0x10, 1385 SES_STATUS_AUDIBLE_ALARM_REMIND_SHIFT = 4, 1386 1387 SES_STATUS_AUDIBLE_ALARM_TONE_INDICATOR_BYTE = 2, 1388 SES_STATUS_AUDIBLE_ALARM_TONE_INDICATOR_MASK = 0x0F, 1389 SES_STATUS_AUDIBLE_ALARM_TONE_INDICATOR_SHIFT = 0, 1390 SES_STATUS_AUDIBLE_ALARM_TONE_INDICATOR_INFO = 0x08, 1391 SES_STATUS_AUDIBLE_ALARM_TONE_INDICATOR_NON_CRIT = 0x04, 1392 SES_STATUS_AUDIBLE_ALARM_TONE_INDICATOR_CRIT = 0x02, 1393 SES_STATUS_AUDIBLE_ALARM_TONE_INDICATOR_UNRECOV = 0x01 1394 }; 1395 1396 #define GEN_SES_STATUS_AUDIBLE_ALARM_ACCESSORS(LCASE, UCASE) \ 1397 GEN_GETTER(ses_status_audible_alarm, SES_STATUS_AUDIBLE_ALARM, LCASE, UCASE) 1398 GEN_SES_STATUS_AUDIBLE_ALARM_ACCESSORS(ident, IDENT) 1399 GEN_SES_STATUS_AUDIBLE_ALARM_ACCESSORS(fail, FAIL) 1400 GEN_SES_STATUS_AUDIBLE_ALARM_ACCESSORS(rqst_mute, RQST_MUTE) 1401 GEN_SES_STATUS_AUDIBLE_ALARM_ACCESSORS(muted, MUTED) 1402 GEN_SES_STATUS_AUDIBLE_ALARM_ACCESSORS(remind, REMIND) 1403 GEN_SES_STATUS_AUDIBLE_ALARM_ACCESSORS(tone_indicator, TONE_INDICATOR) 1404 #undef GEN_SES_STATUS_AUDIBLE_ALARM_ACCESSORS 1405 1406 /*---------- Enclosure Services Statusler Electronics Status Element ---------*/ 1407 struct ses_status_ecc_electronics { 1408 struct ses_status_common common; 1409 uint8_t bytes[3]; 1410 }; 1411 1412 enum ses_status_ecc_electronics_field_data { 1413 SES_STATUS_ECC_ELECTRONICS_IDENT_BYTE = 0, 1414 SES_STATUS_ECC_ELECTRONICS_IDENT_MASK = 0x80, 1415 SES_STATUS_ECC_ELECTRONICS_IDENT_SHIFT = 7, 1416 1417 SES_STATUS_ECC_ELECTRONICS_FAIL_BYTE = 0, 1418 SES_STATUS_ECC_ELECTRONICS_FAIL_MASK = 0x40, 1419 SES_STATUS_ECC_ELECTRONICS_FAIL_SHIFT = 6, 1420 1421 SES_STATUS_ECC_ELECTRONICS_REPORT_BYTE = 1, 1422 SES_STATUS_ECC_ELECTRONICS_REPORT_MASK = 0x01, 1423 SES_STATUS_ECC_ELECTRONICS_REPORT_SHIFT = 0, 1424 1425 SES_STATUS_ECC_ELECTRONICS_HOT_SWAP_BYTE = 2, 1426 SES_STATUS_ECC_ELECTRONICS_HOT_SWAP_MASK = 0x80, 1427 SES_STATUS_ECC_ELECTRONICS_HOT_SWAP_SHIFT = 7 1428 }; 1429 1430 #define GEN_SES_STATUS_ECC_ELECTRONICS_ACCESSORS(LCASE, UCASE) \ 1431 GEN_GETTER(ses_status_ecc_electronics, SES_STATUS_ECC_ELECTRONICS, \ 1432 LCASE, UCASE) 1433 GEN_SES_STATUS_ECC_ELECTRONICS_ACCESSORS(ident, IDENT) 1434 GEN_SES_STATUS_ECC_ELECTRONICS_ACCESSORS(fail, FAIL) 1435 GEN_SES_STATUS_ECC_ELECTRONICS_ACCESSORS(report, REPORT) 1436 GEN_SES_STATUS_ECC_ELECTRONICS_ACCESSORS(hot_swap, HOT_SWAP) 1437 #undef GEN_SES_STATUS_ECC_ELECTRONICS_ACCESSORS 1438 1439 /*------------ SCSI Services Statusler Electronics Status Element ------------*/ 1440 struct ses_status_scc_electronics { 1441 struct ses_status_common common; 1442 uint8_t bytes[3]; 1443 }; 1444 1445 enum ses_status_scc_electronics_field_data { 1446 SES_STATUS_SCC_ELECTRONICS_IDENT_BYTE = 0, 1447 SES_STATUS_SCC_ELECTRONICS_IDENT_MASK = 0x80, 1448 SES_STATUS_SCC_ELECTRONICS_IDENT_SHIFT = 7, 1449 1450 SES_STATUS_SCC_ELECTRONICS_FAIL_BYTE = 0, 1451 SES_STATUS_SCC_ELECTRONICS_FAIL_MASK = 0x40, 1452 SES_STATUS_SCC_ELECTRONICS_FAIL_SHIFT = 6, 1453 1454 SES_STATUS_SCC_ELECTRONICS_REPORT_BYTE = 1, 1455 SES_STATUS_SCC_ELECTRONICS_REPORT_MASK = 0x01, 1456 SES_STATUS_SCC_ELECTRONICS_REPORT_SHIFT = 0 1457 }; 1458 1459 #define GEN_SES_STATUS_SCC_ELECTRONICS_ACCESSORS(LCASE, UCASE) \ 1460 GEN_GETTER(ses_status_scc_electronics, SES_STATUS_SCC_ELECTRONICS, \ 1461 LCASE, UCASE) 1462 GEN_SES_STATUS_SCC_ELECTRONICS_ACCESSORS(ident, IDENT) 1463 GEN_SES_STATUS_SCC_ELECTRONICS_ACCESSORS(fail, FAIL) 1464 GEN_SES_STATUS_SCC_ELECTRONICS_ACCESSORS(report, REPORT) 1465 #undef GEN_SES_STATUS_SCC_ELECTRONICS_ACCESSORS 1466 1467 /*--------------------- Nonvolatile Cache Status Element ---------------------*/ 1468 struct ses_status_nv_cache { 1469 struct ses_status_common common; 1470 uint8_t bytes[1]; 1471 uint8_t cache_size[2]; 1472 }; 1473 1474 enum ses_status_nv_cache_field_data { 1475 SES_STATUS_NV_CACHE_IDENT_BYTE = 0, 1476 SES_STATUS_NV_CACHE_IDENT_MASK = 0x80, 1477 SES_STATUS_NV_CACHE_IDENT_SHIFT = 7, 1478 1479 SES_STATUS_NV_CACHE_FAIL_BYTE = 0, 1480 SES_STATUS_NV_CACHE_FAIL_MASK = 0x40, 1481 SES_STATUS_NV_CACHE_FAIL_SHIFT = 6, 1482 1483 SES_STATUS_NV_CACHE_SIZE_MULTIPLIER_BYTE = 0, 1484 SES_STATUS_NV_CACHE_SIZE_MULTIPLIER_MASK = 0x03, 1485 SES_STATUS_NV_CACHE_SIZE_MULTIPLIER_SHIFT = 0, 1486 SES_STATUS_NV_CACHE_SIZE_MULTIPLIER_BYTES = 0x0, 1487 SES_STATUS_NV_CACHE_SIZE_MULTIPLIER_KBYTES = 0x1, 1488 SES_STATUS_NV_CACHE_SIZE_MULTIPLIER_MBYTES = 0x2, 1489 SES_STATUS_NV_CACHE_SIZE_MULTIPLIER_GBYTES = 0x3 1490 }; 1491 1492 #define GEN_SES_STATUS_NV_CACHE_ACCESSORS(LCASE, UCASE) \ 1493 GEN_GETTER(ses_status_nv_cache, SES_STATUS_NV_CACHE, LCASE, UCASE) 1494 GEN_SES_STATUS_NV_CACHE_ACCESSORS(ident, IDENT) 1495 GEN_SES_STATUS_NV_CACHE_ACCESSORS(fail, FAIL) 1496 GEN_SES_STATUS_NV_CACHE_ACCESSORS(size_multiplier, SIZE_MULTIPLIER) 1497 #undef GEN_SES_STATUS_NV_CACHE_ACCESSORS 1498 1499 static inline uintmax_t 1500 ses_status_nv_cache_get_cache_size(struct ses_status_nv_cache *elem) 1501 { 1502 uintmax_t cache_size; 1503 int multiplier; 1504 1505 /* Multiplier is in units of 2^10 */ 1506 cache_size = scsi_2btoul(elem->cache_size); 1507 multiplier = 10 * ses_status_nv_cache_get_size_multiplier(elem); 1508 return (cache_size << multiplier); 1509 } 1510 1511 /*----------------- Invalid Operation Reason Status Element ------------------*/ 1512 struct ses_status_invalid_op_reason { 1513 struct ses_status_common common; 1514 uint8_t bytes[3]; 1515 }; 1516 1517 enum ses_status_invalid_op_field_data { 1518 SES_STATUS_INVALID_OP_REASON_TYPE_BYTE = 0, 1519 SES_STATUS_INVALID_OP_REASON_TYPE_MASK = 0xC0, 1520 SES_STATUS_INVALID_OP_REASON_TYPE_SHIFT = 6, 1521 SES_STATUS_INVALID_OP_REASON_TYPE_PC_ERROR = 0x00, 1522 SES_STATUS_INVALID_OP_REASON_TYPE_PF_ERROR = 0x01, 1523 SES_STATUS_INVALID_OP_REASON_TYPE_VS_ERROR = 0x03, 1524 1525 SES_STATUS_INVALID_OP_REASON_PC_ERROR_PC_NOT_SUPPORTED_BYTE = 0, 1526 SES_STATUS_INVALID_OP_REASON_PC_ERROR_PC_NOT_SUPPORTED_MASK = 0x01, 1527 SES_STATUS_INVALID_OP_REASON_PC_ERROR_PC_NOT_SUPPORTED_SHIFT = 0, 1528 1529 SES_STATUS_INVALID_OP_REASON_PF_ERROR_BIT_NUMBER_BYTE = 0, 1530 SES_STATUS_INVALID_OP_REASON_PF_ERROR_BIT_NUMBER_MASK = 0x03, 1531 SES_STATUS_INVALID_OP_REASON_PF_ERROR_BIT_NUMBER_SHIFT = 0 1532 }; 1533 1534 #define GEN_SES_STATUS_INVALID_OP_REASON_ACCESSORS(LCASE, UCASE) \ 1535 GEN_GETTER(ses_status_invalid_op_reason, SES_STATUS_INVALID_OP_REASON, \ 1536 LCASE, UCASE) 1537 GEN_SES_STATUS_INVALID_OP_REASON_ACCESSORS(type, TYPE) 1538 GEN_SES_STATUS_INVALID_OP_REASON_ACCESSORS(pc_error_pc_not_supported, 1539 PC_ERROR_PC_NOT_SUPPORTED) 1540 GEN_SES_STATUS_INVALID_OP_REASON_ACCESSORS(pf_error_bit_number, 1541 PF_ERROR_BIT_NUMBER) 1542 #undef GEN_SES_STATUS_INVALID_OP_ACCESSORS 1543 1544 /*--------------- Uninterruptible Power Supply Status Element ----------------*/ 1545 struct ses_status_ups { 1546 struct ses_status_common common; 1547 /* Minutes of remaining capacity. */ 1548 uint8_t battery_status; 1549 uint8_t bytes[2]; 1550 }; 1551 1552 enum ses_status_ups_field_data { 1553 SES_STATUS_UPS_AC_LO_BYTE = 0, 1554 SES_STATUS_UPS_AC_LO_MASK = 0x80, 1555 SES_STATUS_UPS_AC_LO_SHIFT = 7, 1556 1557 SES_STATUS_UPS_AC_HI_BYTE = 0, 1558 SES_STATUS_UPS_AC_HI_MASK = 0x40, 1559 SES_STATUS_UPS_AC_HI_SHIFT = 6, 1560 1561 SES_STATUS_UPS_AC_QUAL_BYTE = 0, 1562 SES_STATUS_UPS_AC_QUAL_MASK = 0x20, 1563 SES_STATUS_UPS_AC_QUAL_SHIFT = 5, 1564 1565 SES_STATUS_UPS_AC_FAIL_BYTE = 0, 1566 SES_STATUS_UPS_AC_FAIL_MASK = 0x10, 1567 SES_STATUS_UPS_AC_FAIL_SHIFT = 4, 1568 1569 SES_STATUS_UPS_DC_FAIL_BYTE = 0, 1570 SES_STATUS_UPS_DC_FAIL_MASK = 0x08, 1571 SES_STATUS_UPS_DC_FAIL_SHIFT = 3, 1572 1573 SES_STATUS_UPS_UPS_FAIL_BYTE = 0, 1574 SES_STATUS_UPS_UPS_FAIL_MASK = 0x04, 1575 SES_STATUS_UPS_UPS_FAIL_SHIFT = 2, 1576 1577 SES_STATUS_UPS_WARN_BYTE = 0, 1578 SES_STATUS_UPS_WARN_MASK = 0x02, 1579 SES_STATUS_UPS_WARN_SHIFT = 1, 1580 1581 SES_STATUS_UPS_INTF_FAIL_BYTE = 0, 1582 SES_STATUS_UPS_INTF_FAIL_MASK = 0x01, 1583 SES_STATUS_UPS_INTF_FAIL_SHIFT = 0, 1584 1585 SES_STATUS_UPS_IDENT_BYTE = 0, 1586 SES_STATUS_UPS_IDENT_MASK = 0x80, 1587 SES_STATUS_UPS_IDENT_SHIFT = 7, 1588 1589 SES_STATUS_UPS_FAIL_BYTE = 1, 1590 SES_STATUS_UPS_FAIL_MASK = 0x40, 1591 SES_STATUS_UPS_FAIL_SHIFT = 6, 1592 1593 SES_STATUS_UPS_BATT_FAIL_BYTE = 1, 1594 SES_STATUS_UPS_BATT_FAIL_MASK = 0x02, 1595 SES_STATUS_UPS_BATT_FAIL_SHIFT = 1, 1596 1597 SES_STATUS_UPS_BPF_BYTE = 1, 1598 SES_STATUS_UPS_BPF_MASK = 0x01, 1599 SES_STATUS_UPS_BPF_SHIFT = 0 1600 }; 1601 1602 #define GEN_SES_STATUS_UPS_ACCESSORS(LCASE, UCASE) \ 1603 GEN_GETTER(ses_status_ups, SES_STATUS_UPS, LCASE, UCASE) 1604 GEN_SES_STATUS_UPS_ACCESSORS(ac_lo, AC_LO) 1605 GEN_SES_STATUS_UPS_ACCESSORS(ac_hi, AC_HI) 1606 GEN_SES_STATUS_UPS_ACCESSORS(ac_qual, AC_QUAL) 1607 GEN_SES_STATUS_UPS_ACCESSORS(ac_fail, AC_FAIL) 1608 GEN_SES_STATUS_UPS_ACCESSORS(dc_fail, DC_FAIL) 1609 GEN_SES_STATUS_UPS_ACCESSORS(ups_fail, UPS_FAIL) 1610 GEN_SES_STATUS_UPS_ACCESSORS(warn, WARN) 1611 GEN_SES_STATUS_UPS_ACCESSORS(intf_fail, INTF_FAIL) 1612 GEN_SES_STATUS_UPS_ACCESSORS(ident, IDENT) 1613 GEN_SES_STATUS_UPS_ACCESSORS(fail, FAIL) 1614 GEN_SES_STATUS_UPS_ACCESSORS(batt_fail, BATT_FAIL) 1615 GEN_SES_STATUS_UPS_ACCESSORS(bpf, BPF) 1616 #undef GEN_SES_STATUS_UPS_ACCESSORS 1617 1618 /*-------------------------- Display Status Element --------------------------*/ 1619 struct ses_status_display { 1620 struct ses_status_common common; 1621 uint8_t bytes[1]; 1622 uint8_t display_character[2]; 1623 }; 1624 1625 enum ses_status_display_field_data { 1626 SES_STATUS_DISPLAY_IDENT_BYTE = 0, 1627 SES_STATUS_DISPLAY_IDENT_MASK = 0x80, 1628 SES_STATUS_DISPLAY_IDENT_SHIFT = 7, 1629 1630 SES_STATUS_DISPLAY_FAIL_BYTE = 0, 1631 SES_STATUS_DISPLAY_FAIL_MASK = 0x40, 1632 SES_STATUS_DISPLAY_FAIL_SHIFT = 6, 1633 1634 SES_STATUS_DISPLAY_DISPLAY_MODE_BYTE = 0, 1635 SES_STATUS_DISPLAY_DISPLAY_MODE_MASK = 0x03, 1636 SES_STATUS_DISPLAY_DISPLAY_MODE_SHIFT = 6, 1637 SES_STATUS_DISPLAY_DISPLAY_MODE_DC_FIELD_UNSUPP = 0x0, 1638 SES_STATUS_DISPLAY_DISPLAY_MODE_DC_FIELD_SUPP = 0x1, 1639 SES_STATUS_DISPLAY_DISPLAY_MODE_DC_FIELD = 0x2 1640 }; 1641 1642 #define GEN_SES_STATUS_DISPLAY_ACCESSORS(LCASE, UCASE) \ 1643 GEN_GETTER(ses_status_display, SES_STATUS_DISPLAY, LCASE, UCASE) 1644 GEN_SES_STATUS_DISPLAY_ACCESSORS(ident, IDENT) 1645 GEN_SES_STATUS_DISPLAY_ACCESSORS(fail, FAIL) 1646 GEN_SES_STATUS_DISPLAY_ACCESSORS(display_mode, DISPLAY_MODE) 1647 #undef GEN_SES_STATUS_DISPLAY_ACCESSORS 1648 1649 /*----------------------- Key Pad Entry Status Element -----------------------*/ 1650 struct ses_status_key_pad_entry { 1651 struct ses_status_common common; 1652 uint8_t bytes[3]; 1653 }; 1654 1655 enum ses_status_key_pad_entry_field_data { 1656 SES_STATUS_KEY_PAD_ENTRY_IDENT_BYTE = 0, 1657 SES_STATUS_KEY_PAD_ENTRY_IDENT_MASK = 0x80, 1658 SES_STATUS_KEY_PAD_ENTRY_IDENT_SHIFT = 7, 1659 1660 SES_STATUS_KEY_PAD_ENTRY_FAIL_BYTE = 0, 1661 SES_STATUS_KEY_PAD_ENTRY_FAIL_MASK = 0x40, 1662 SES_STATUS_KEY_PAD_ENTRY_FAIL_SHIFT = 6 1663 }; 1664 1665 #define GEN_SES_STATUS_KEY_PAD_ENTRY_ACCESSORS(LCASE, UCASE) \ 1666 GEN_GETTER(ses_status_key_pad_entry, SES_STATUS_KEY_PAD_ENTRY, LCASE, UCASE) 1667 GEN_SES_STATUS_KEY_PAD_ENTRY_ACCESSORS(ident, IDENT) 1668 GEN_SES_STATUS_KEY_PAD_ENTRY_ACCESSORS(fail, FAIL) 1669 #undef GEN_SES_STATUS_KEY_PAD_ENTRY_ACCESSORS 1670 1671 /*------------------------- Enclosure Status Element -------------------------*/ 1672 struct ses_status_enclosure { 1673 struct ses_status_common common; 1674 uint8_t bytes[3]; 1675 }; 1676 1677 enum ses_status_enclosure_field_data { 1678 SES_STATUS_ENCLOSURE_IDENT_BYTE = 0, 1679 SES_STATUS_ENCLOSURE_IDENT_MASK = 0x80, 1680 SES_STATUS_ENCLOSURE_IDENT_SHIFT = 7, 1681 1682 SES_STATUS_ENCLOSURE_TIME_UNTIL_POWER_CYCLE_BYTE = 1, 1683 SES_STATUS_ENCLOSURE_TIME_UNTIL_POWER_CYCLE_MASK = 0xFC, 1684 SES_STATUS_ENCLOSURE_TIME_UNTIL_POWER_CYCLE_SHIFT = 2, 1685 1686 SES_STATUS_ENCLOSURE_FAIL_BYTE = 1, 1687 SES_STATUS_ENCLOSURE_FAIL_MASK = 0x02, 1688 SES_STATUS_ENCLOSURE_FAIL_SHIFT = 1, 1689 1690 SES_STATUS_ENCLOSURE_WARN_BYTE = 1, 1691 SES_STATUS_ENCLOSURE_WARN_MASK = 0x01, 1692 SES_STATUS_ENCLOSURE_WARN_SHIFT = 0, 1693 1694 SES_STATUS_ENCLOSURE_REQUESTED_POWER_OFF_DURATION_BYTE = 2, 1695 SES_STATUS_ENCLOSURE_REQUESTED_POWER_OFF_DURATION_MASK = 0xFC, 1696 SES_STATUS_ENCLOSURE_REQUESTED_POWER_OFF_DURATION_SHIFT = 2, 1697 SES_STATUS_ENCLOSURE_REQUESTED_POWER_OFF_DURATION_MAX_AUTO = 60, 1698 SES_STATUS_ENCLOSURE_REQUESTED_POWER_OFF_DURATION_MANUAL = 63, 1699 1700 SES_STATUS_ENCLOSURE_REQUESTED_FAIL_BYTE = 2, 1701 SES_STATUS_ENCLOSURE_REQUESTED_FAIL_MASK = 0x02, 1702 SES_STATUS_ENCLOSURE_REQUESTED_FAIL_SHIFT = 1, 1703 1704 SES_STATUS_ENCLOSURE_REQUESTED_WARN_BYTE = 2, 1705 SES_STATUS_ENCLOSURE_REQUESTED_WARN_MASK = 0x01, 1706 SES_STATUS_ENCLOSURE_REQUESTED_WARN_SHIFT = 0 1707 }; 1708 1709 #define GEN_SES_STATUS_ENCLOSURE_ACCESSORS(LCASE, UCASE) \ 1710 GEN_GETTER(ses_status_enclosure, SES_STATUS_ENCLOSURE, LCASE, UCASE) 1711 GEN_SES_STATUS_ENCLOSURE_ACCESSORS(ident, IDENT) 1712 GEN_SES_STATUS_ENCLOSURE_ACCESSORS(time_until_power_cycle, 1713 TIME_UNTIL_POWER_CYCLE) 1714 GEN_SES_STATUS_ENCLOSURE_ACCESSORS(fail, FAIL) 1715 GEN_SES_STATUS_ENCLOSURE_ACCESSORS(warn, WARN) 1716 GEN_SES_STATUS_ENCLOSURE_ACCESSORS(requested_power_off_duration, 1717 REQUESTED_POWER_OFF_DURATION) 1718 GEN_SES_STATUS_ENCLOSURE_ACCESSORS(requested_fail, REQUESTED_FAIL) 1719 GEN_SES_STATUS_ENCLOSURE_ACCESSORS(requested_warn, REQUESTED_WARN) 1720 #undef GEN_SES_STATUS_ENCLOSURE_ACCESSORS 1721 1722 /*------------------- SCSI Port/Transceiver Status Element -------------------*/ 1723 struct ses_status_scsi_port_or_xcvr { 1724 struct ses_status_common common; 1725 uint8_t bytes[3]; 1726 }; 1727 1728 enum ses_status_scsi_port_or_xcvr_field_data { 1729 SES_STATUS_SCSI_PORT_OR_XCVR_IDENT_BYTE = 0, 1730 SES_STATUS_SCSI_PORT_OR_XCVR_IDENT_MASK = 0x80, 1731 SES_STATUS_SCSI_PORT_OR_XCVR_IDENT_SHIFT = 7, 1732 1733 SES_STATUS_SCSI_PORT_OR_XCVR_FAIL_BYTE = 0, 1734 SES_STATUS_SCSI_PORT_OR_XCVR_FAIL_MASK = 0x40, 1735 SES_STATUS_SCSI_PORT_OR_XCVR_FAIL_SHIFT = 6, 1736 1737 SES_STATUS_SCSI_PORT_OR_XCVR_REPORT_BYTE = 1, 1738 SES_STATUS_SCSI_PORT_OR_XCVR_REPORT_MASK = 0x01, 1739 SES_STATUS_SCSI_PORT_OR_XCVR_REPORT_SHIFT = 0, 1740 1741 SES_STATUS_SCSI_PORT_OR_XCVR_DISABLED_BYTE = 2, 1742 SES_STATUS_SCSI_PORT_OR_XCVR_DISABLED_MASK = 0x10, 1743 SES_STATUS_SCSI_PORT_OR_XCVR_DISABLED_SHIFT = 4, 1744 1745 SES_STATUS_SCSI_PORT_OR_XCVR_LOL_BYTE = 2, 1746 SES_STATUS_SCSI_PORT_OR_XCVR_LOL_MASK = 0x02, 1747 SES_STATUS_SCSI_PORT_OR_XCVR_LOL_SHIFT = 1, 1748 1749 SES_STATUS_SCSI_PORT_OR_XCVR_XMIT_FAIL_BYTE = 2, 1750 SES_STATUS_SCSI_PORT_OR_XCVR_XMIT_FAIL_MASK = 0x01, 1751 SES_STATUS_SCSI_PORT_OR_XCVR_XMIT_FAIL_SHIFT = 0 1752 }; 1753 1754 #define GEN_SES_STATUS_SCSI_PORT_OR_XCVR_ACCESSORS(LCASE, UCASE) \ 1755 GEN_GETTER(ses_status_scsi_port_or_xcvr, SES_STATUS_SCSI_PORT_OR_XCVR,\ 1756 LCASE, UCASE) 1757 GEN_SES_STATUS_SCSI_PORT_OR_XCVR_ACCESSORS(ident, IDENT) 1758 GEN_SES_STATUS_SCSI_PORT_OR_XCVR_ACCESSORS(fail, FAIL) 1759 GEN_SES_STATUS_SCSI_PORT_OR_XCVR_ACCESSORS(report, REPORT) 1760 GEN_SES_STATUS_SCSI_PORT_OR_XCVR_ACCESSORS(disable, DISABLED) 1761 GEN_SES_STATUS_SCSI_PORT_OR_XCVR_ACCESSORS(lol, LOL) 1762 GEN_SES_STATUS_SCSI_PORT_OR_XCVR_ACCESSORS(xmit_fail, XMIT_FAIL) 1763 #undef GEN_SES_STATUS_SCSI_PORT_OR_XCVR_ACCESSORS 1764 1765 /*------------------------- Language Status Element --------------------------*/ 1766 struct ses_status_language { 1767 struct ses_status_common common; 1768 uint8_t bytes[1]; 1769 uint8_t language_code[2]; 1770 }; 1771 1772 enum ses_status_language_field_data { 1773 SES_STATUS_LANGUAGE_IDENT_BYTE = 0, 1774 SES_STATUS_LANGUAGE_IDENT_MASK = 0x80, 1775 SES_STATUS_LANGUAGE_IDENT_SHIFT = 7 1776 }; 1777 1778 #define GEN_SES_STATUS_LANGUAGE_ACCESSORS(LCASE, UCASE) \ 1779 GEN_GETTER(ses_status_language, SES_STATUS_LANGUAGE, LCASE, UCASE) 1780 GEN_SES_STATUS_LANGUAGE_ACCESSORS(ident, IDENT) 1781 #undef GEN_SES_STATUS_LANGUAGE_ACCESSORS 1782 1783 /*-------------------- Communication Port Status Element ---------------------*/ 1784 struct ses_status_comm_port { 1785 struct ses_status_common common; 1786 uint8_t bytes[3]; 1787 }; 1788 1789 enum ses_status_comm_port_field_data { 1790 SES_STATUS_COMM_PORT_IDENT_BYTE = 0, 1791 SES_STATUS_COMM_PORT_IDENT_MASK = 0x80, 1792 SES_STATUS_COMM_PORT_IDENT_SHIFT = 7, 1793 1794 SES_STATUS_COMM_PORT_FAIL_BYTE = 0, 1795 SES_STATUS_COMM_PORT_FAIL_MASK = 0x40, 1796 SES_STATUS_COMM_PORT_FAIL_SHIFT = 6, 1797 1798 SES_STATUS_COMM_PORT_DISABLED_BYTE = 2, 1799 SES_STATUS_COMM_PORT_DISABLED_MASK = 0x01, 1800 SES_STATUS_COMM_PORT_DISABLED_SHIFT = 0 1801 }; 1802 1803 #define GEN_SES_STATUS_COMM_PORT_ACCESSORS(LCASE, UCASE) \ 1804 GEN_GETTER(ses_status_comm_port, SES_STATUS_COMM_PORT, LCASE, UCASE) 1805 GEN_SES_STATUS_COMM_PORT_ACCESSORS(ident, IDENT) 1806 GEN_SES_STATUS_COMM_PORT_ACCESSORS(fail, FAIL) 1807 GEN_SES_STATUS_COMM_PORT_ACCESSORS(disabled, DISABLED) 1808 #undef GEN_SES_STATUS_COMM_PORT_ACCESSORS 1809 1810 /*---------------------- Voltage Sensor Status Element -----------------------*/ 1811 struct ses_status_voltage_sensor { 1812 struct ses_status_common common; 1813 uint8_t bytes[1]; 1814 uint8_t voltage[2]; 1815 }; 1816 1817 enum ses_status_voltage_sensor_field_data { 1818 SES_STATUS_VOLTAGE_SENSOR_IDENT_BYTE = 0, 1819 SES_STATUS_VOLTAGE_SENSOR_IDENT_MASK = 0x80, 1820 SES_STATUS_VOLTAGE_SENSOR_IDENT_SHIFT = 7, 1821 1822 SES_STATUS_VOLTAGE_SENSOR_FAIL_BYTE = 0, 1823 SES_STATUS_VOLTAGE_SENSOR_FAIL_MASK = 0x40, 1824 SES_STATUS_VOLTAGE_SENSOR_FAIL_SHIFT = 6, 1825 1826 SES_STATUS_VOLTAGE_SENSOR_WARN_OVER_BYTE = 0, 1827 SES_STATUS_VOLTAGE_SENSOR_WARN_OVER_MASK = 0x08, 1828 SES_STATUS_VOLTAGE_SENSOR_WARN_OVER_SHIFT = 3, 1829 1830 SES_STATUS_VOLTAGE_SENSOR_WARN_UNDER_BYTE = 0, 1831 SES_STATUS_VOLTAGE_SENSOR_WARN_UNDER_MASK = 0x04, 1832 SES_STATUS_VOLTAGE_SENSOR_WARN_UNDER_SHIFT = 2, 1833 1834 SES_STATUS_VOLTAGE_SENSOR_CRIT_OVER_BYTE = 0, 1835 SES_STATUS_VOLTAGE_SENSOR_CRIT_OVER_MASK = 0x02, 1836 SES_STATUS_VOLTAGE_SENSOR_CRIT_OVER_SHIFT = 1, 1837 1838 SES_STATUS_VOLTAGE_SENSOR_CRIT_UNDER_BYTE = 0, 1839 SES_STATUS_VOLTAGE_SENSOR_CRIT_UNDER_MASK = 0x01, 1840 SES_STATUS_VOLTAGE_SENSOR_CRIT_UNDER_SHIFT = 0 1841 }; 1842 1843 #define GEN_SES_STATUS_VOLTAGE_SENSOR_ACCESSORS(LCASE, UCASE) \ 1844 GEN_GETTER(ses_status_voltage_sensor, SES_STATUS_VOLTAGE_SENSOR, \ 1845 LCASE, UCASE) 1846 GEN_SES_STATUS_VOLTAGE_SENSOR_ACCESSORS(ident, IDENT) 1847 GEN_SES_STATUS_VOLTAGE_SENSOR_ACCESSORS(fail, FAIL) 1848 GEN_SES_STATUS_VOLTAGE_SENSOR_ACCESSORS(warn_over, WARN_OVER) 1849 GEN_SES_STATUS_VOLTAGE_SENSOR_ACCESSORS(warn_under, WARN_UNDER) 1850 GEN_SES_STATUS_VOLTAGE_SENSOR_ACCESSORS(crit_over, CRIT_OVER) 1851 GEN_SES_STATUS_VOLTAGE_SENSOR_ACCESSORS(crit_under, CRIT_UNDER) 1852 #undef GEN_SES_STATUS_VOLTAGE_SENSOR_ACCESSORS 1853 1854 /*---------------------- Current Sensor Status Element -----------------------*/ 1855 struct ses_status_current_sensor { 1856 struct ses_status_common common; 1857 uint8_t bytes[3]; 1858 }; 1859 1860 enum ses_status_current_sensor_field_data { 1861 SES_STATUS_CURRENT_SENSOR_IDENT_BYTE = 0, 1862 SES_STATUS_CURRENT_SENSOR_IDENT_MASK = 0x80, 1863 SES_STATUS_CURRENT_SENSOR_IDENT_SHIFT = 7, 1864 1865 SES_STATUS_CURRENT_SENSOR_FAIL_BYTE = 0, 1866 SES_STATUS_CURRENT_SENSOR_FAIL_MASK = 0x40, 1867 SES_STATUS_CURRENT_SENSOR_FAIL_SHIFT = 6, 1868 1869 SES_STATUS_CURRENT_SENSOR_WARN_OVER_BYTE = 0, 1870 SES_STATUS_CURRENT_SENSOR_WARN_OVER_MASK = 0x08, 1871 SES_STATUS_CURRENT_SENSOR_WARN_OVER_SHIFT = 3, 1872 1873 SES_STATUS_CURRENT_SENSOR_CRIT_OVER_BYTE = 0, 1874 SES_STATUS_CURRENT_SENSOR_CRIT_OVER_MASK = 0x02, 1875 SES_STATUS_CURRENT_SENSOR_CRIT_OVER_SHIFT = 1 1876 }; 1877 1878 #define GEN_SES_STATUS_CURRENT_SENSOR_ACCESSORS(LCASE, UCASE) \ 1879 GEN_GETTER(ses_status_current_sensor, SES_STATUS_CURRENT_SENSOR, \ 1880 LCASE, UCASE) 1881 GEN_SES_STATUS_CURRENT_SENSOR_ACCESSORS(ident, IDENT) 1882 GEN_SES_STATUS_CURRENT_SENSOR_ACCESSORS(fail, FAIL) 1883 GEN_SES_STATUS_CURRENT_SENSOR_ACCESSORS(warn_over, WARN_OVER) 1884 GEN_SES_STATUS_CURRENT_SENSOR_ACCESSORS(crit_over, CRIT_OVER) 1885 #undef GEN_SES_STATUS_CURRENT_SENSOR_ACCESSORS 1886 1887 /*--------------------- SCSI Target Port Status Element ----------------------*/ 1888 struct ses_status_target_port { 1889 struct ses_status_common common; 1890 uint8_t bytes[3]; 1891 }; 1892 1893 enum ses_status_scsi_target_port_field_data { 1894 SES_STATUS_TARGET_PORT_IDENT_BYTE = 0, 1895 SES_STATUS_TARGET_PORT_IDENT_MASK = 0x80, 1896 SES_STATUS_TARGET_PORT_IDENT_SHIFT = 7, 1897 1898 SES_STATUS_TARGET_PORT_FAIL_BYTE = 0, 1899 SES_STATUS_TARGET_PORT_FAIL_MASK = 0x40, 1900 SES_STATUS_TARGET_PORT_FAIL_SHIFT = 6, 1901 1902 SES_STATUS_TARGET_PORT_REPORT_BYTE = 1, 1903 SES_STATUS_TARGET_PORT_REPORT_MASK = 0x01, 1904 SES_STATUS_TARGET_PORT_REPORT_SHIFT = 0, 1905 1906 SES_STATUS_TARGET_PORT_ENABLED_BYTE = 2, 1907 SES_STATUS_TARGET_PORT_ENABLED_MASK = 0x01, 1908 SES_STATUS_TARGET_PORT_ENABLED_SHIFT = 0 1909 }; 1910 1911 #define GEN_SES_STATUS_TARGET_PORT_ACCESSORS(LCASE, UCASE) \ 1912 GEN_GETTER(ses_status_target_port, SES_STATUS_TARGET_PORT, LCASE, UCASE) 1913 GEN_SES_STATUS_TARGET_PORT_ACCESSORS(ident, IDENT) 1914 GEN_SES_STATUS_TARGET_PORT_ACCESSORS(fail, FAIL) 1915 GEN_SES_STATUS_TARGET_PORT_ACCESSORS(report, REPORT) 1916 GEN_SES_STATUS_TARGET_PORT_ACCESSORS(enabled, ENABLED) 1917 #undef GEN_SES_STATUS_TARGET_PORT_ACCESSORS 1918 1919 /*-------------------- SCSI Initiator Port Status Element --------------------*/ 1920 struct ses_status_initiator_port { 1921 struct ses_status_common common; 1922 uint8_t bytes[3]; 1923 }; 1924 1925 enum ses_status_scsi_initiator_port_field_data { 1926 SES_STATUS_INITIATOR_PORT_IDENT_BYTE = 0, 1927 SES_STATUS_INITIATOR_PORT_IDENT_MASK = 0x80, 1928 SES_STATUS_INITIATOR_PORT_IDENT_SHIFT = 7, 1929 1930 SES_STATUS_INITIATOR_PORT_FAIL_BYTE = 0, 1931 SES_STATUS_INITIATOR_PORT_FAIL_MASK = 0x40, 1932 SES_STATUS_INITIATOR_PORT_FAIL_SHIFT = 6, 1933 1934 SES_STATUS_INITIATOR_PORT_REPORT_BYTE = 1, 1935 SES_STATUS_INITIATOR_PORT_REPORT_MASK = 0x01, 1936 SES_STATUS_INITIATOR_PORT_REPORT_SHIFT = 0, 1937 1938 SES_STATUS_INITIATOR_PORT_ENABLED_BYTE = 2, 1939 SES_STATUS_INITIATOR_PORT_ENABLED_MASK = 0x01, 1940 SES_STATUS_INITIATOR_PORT_ENABLED_SHIFT = 0 1941 }; 1942 1943 #define GEN_SES_STATUS_INITIATOR_PORT_ACCESSORS(LCASE, UCASE) \ 1944 GEN_GETTER(ses_status_initiator_port, SES_STATUS_INITIATOR_PORT, \ 1945 LCASE, UCASE) 1946 GEN_SES_STATUS_INITIATOR_PORT_ACCESSORS(ident, IDENT) 1947 GEN_SES_STATUS_INITIATOR_PORT_ACCESSORS(fail, FAIL) 1948 GEN_SES_STATUS_INITIATOR_PORT_ACCESSORS(report, REPORT) 1949 GEN_SES_STATUS_INITIATOR_PORT_ACCESSORS(enabled, ENABLED) 1950 #undef GEN_SES_STATUS_INITIATOR_PORT_ACCESSORS 1951 1952 /*-------------------- Simple Subenclosure Status Element --------------------*/ 1953 struct ses_status_simple_subses { 1954 struct ses_status_common common; 1955 uint8_t bytes[2]; 1956 uint8_t short_enclosure_status; 1957 }; 1958 1959 enum ses_status_simple_subses_field_data { 1960 SES_STATUS_SIMPlE_SUBSES_IDENT_BYTE = 0, 1961 SES_STATUS_SIMPlE_SUBSES_IDENT_MASK = 0x80, 1962 SES_STATUS_SIMPlE_SUBSES_IDENT_SHIFT = 7, 1963 1964 SES_STATUS_SIMPlE_SUBSES_FAIL_BYTE = 0, 1965 SES_STATUS_SIMPlE_SUBSES_FAIL_MASK = 0x40, 1966 SES_STATUS_SIMPlE_SUBSES_FAIL_SHIFT = 6 1967 }; 1968 1969 #define GEN_SES_STATUS_SIMPlE_SUBSES_ACCESSORS(LCASE, UCASE) \ 1970 GEN_GETTER(ses_status_simple_subses, SES_STATUS_SIMPlE_SUBSES, \ 1971 LCASE, UCASE) 1972 GEN_SES_STATUS_SIMPlE_SUBSES_ACCESSORS(ident, IDENT) 1973 GEN_SES_STATUS_SIMPlE_SUBSES_ACCESSORS(fail, FAIL) 1974 #undef GEN_SES_STATUS_SIMPlE_SUBSES_ACCESSORS 1975 1976 /*----------------------- SAS Expander Status Element ------------------------*/ 1977 struct ses_status_sas_expander { 1978 struct ses_status_common common; 1979 uint8_t bytes[3]; 1980 }; 1981 1982 enum ses_status_sas_expander_field_data { 1983 SES_STATUS_SAS_EXPANDER_IDENT_BYTE = 0, 1984 SES_STATUS_SAS_EXPANDER_IDENT_MASK = 0x80, 1985 SES_STATUS_SAS_EXPANDER_IDENT_SHIFT = 7, 1986 1987 SES_STATUS_SAS_EXPANDER_FAIL_BYTE = 0, 1988 SES_STATUS_SAS_EXPANDER_FAIL_MASK = 0x40, 1989 SES_STATUS_SAS_EXPANDER_FAIL_SHIFT = 6 1990 }; 1991 1992 #define GEN_SES_STATUS_SAS_EXPANDER_ACCESSORS(LCASE, UCASE) \ 1993 GEN_GETTER(ses_status_sas_expander, SES_STATUS_SAS_EXPANDER, LCASE, UCASE) 1994 GEN_SES_STATUS_SAS_EXPANDER_ACCESSORS(ident, IDENT) 1995 GEN_SES_STATUS_SAS_EXPANDER_ACCESSORS(fail, FAIL) 1996 #undef GEN_SES_STATUS_SAS_EXPANDER_ACCESSORS 1997 1998 /*----------------------- SAS Connector Status Element -----------------------*/ 1999 struct ses_status_sas_connector { 2000 struct ses_status_common common; 2001 uint8_t bytes[3]; 2002 }; 2003 2004 enum ses_status_sas_connector_field_data { 2005 SES_STATUS_SAS_CONNECTOR_IDENT_BYTE = 0, 2006 SES_STATUS_SAS_CONNECTOR_IDENT_MASK = 0x80, 2007 SES_STATUS_SAS_CONNECTOR_IDENT_SHIFT = 7, 2008 2009 SES_STATUS_SAS_CONNECTOR_TYPE_BYTE = 0, 2010 SES_STATUS_SAS_CONNECTOR_TYPE_MASK = 0x7F, 2011 SES_STATUS_SAS_CONNECTOR_TYPE_SHIFT = 0, 2012 2013 SES_STATUS_SAS_CONNECTOR_PHYS_LINK_BYTE = 1, 2014 SES_STATUS_SAS_CONNECTOR_PHYS_LINK_MASK = 0xFF, 2015 SES_STATUS_SAS_CONNECTOR_PHYS_LINK_SHIFT = 0, 2016 SES_STATUS_SAS_CONNECTOR_PHYS_LINK_ALL = 0xFF, 2017 2018 SES_STATUS_SAS_CONNECTOR_FAIL_BYTE = 2, 2019 SES_STATUS_SAS_CONNECTOR_FAIL_MASK = 0x40, 2020 SES_STATUS_SAS_CONNECTOR_FAIL_SHIFT = 6, 2021 }; 2022 2023 #define GEN_SES_STATUS_SAS_CONNECTOR_ACCESSORS(LCASE, UCASE) \ 2024 GEN_GETTER(ses_status_sas_connector, SES_STATUS_SAS_CONNECTOR, \ 2025 LCASE, UCASE) 2026 GEN_SES_STATUS_SAS_CONNECTOR_ACCESSORS(ident, IDENT) 2027 GEN_SES_STATUS_SAS_CONNECTOR_ACCESSORS(type, TYPE) 2028 GEN_SES_STATUS_SAS_CONNECTOR_ACCESSORS(phys_link, PHYS_LINK) 2029 GEN_SES_STATUS_SAS_CONNECTOR_ACCESSORS(fail, FAIL) 2030 #undef GEN_SES_STATUS_SAS_CONNECTOR_ACCESSORS 2031 2032 /*------------------------- Universal Status Element -------------------------*/ 2033 union ses_status_element { 2034 struct ses_status_common common; 2035 struct ses_status_dev_slot dev_slot; 2036 struct ses_status_array_dev_slot array_dev_slot; 2037 struct ses_status_power_supply power_supply; 2038 struct ses_status_cooling cooling; 2039 struct ses_status_temp_sensor temp_sensor; 2040 struct ses_status_door_lock door_lock; 2041 struct ses_status_audible_alarm audible_alarm; 2042 struct ses_status_ecc_electronics ecc_electronics; 2043 struct ses_status_scc_electronics scc_electronics; 2044 struct ses_status_nv_cache nv_cache; 2045 struct ses_status_invalid_op_reason invalid_op_reason; 2046 struct ses_status_ups ups; 2047 struct ses_status_display display; 2048 struct ses_status_key_pad_entry key_pad_entry; 2049 struct ses_status_scsi_port_or_xcvr scsi_port_or_xcvr; 2050 struct ses_status_language language; 2051 struct ses_status_comm_port comm_port; 2052 struct ses_status_voltage_sensor voltage_sensor; 2053 struct ses_status_current_sensor current_sensor; 2054 struct ses_status_target_port target_port; 2055 struct ses_status_initiator_port initiator_port; 2056 struct ses_status_simple_subses simple_subses; 2057 struct ses_status_sas_expander sas_expander; 2058 struct ses_status_sas_connector sas_connector; 2059 uint8_t bytes[4]; 2060 }; 2061 2062 /*===================== SCSI SES Status Diagnostic Page =====================*/ 2063 struct ses_status_page { 2064 struct ses_page_hdr hdr; 2065 union ses_status_element elements[]; 2066 }; 2067 2068 enum ses_status_page_field_data { 2069 SES_STATUS_PAGE_INVOP_MASK = 0x10, 2070 SES_STATUS_PAGE_INVOP_SHIFT = 4, 2071 2072 SES_STATUS_PAGE_INFO_MASK = 0x08, 2073 SES_STATUS_PAGE_INFO_SHIFT = 3, 2074 2075 SES_STATUS_PAGE_NON_CRIT_MASK = 0x04, 2076 SES_STATUS_PAGE_NON_CRIT_SHIFT = 2, 2077 2078 SES_STATUS_PAGE_CRIT_MASK = 0x02, 2079 SES_STATUS_PAGE_CRIT_SHIFT = 1, 2080 2081 SES_STATUS_PAGE_UNRECOV_MASK = 0x01, 2082 SES_STATUS_PAGE_UNRECOV_SHIFT = 0, 2083 2084 SES_STATUS_PAGE_CHANGED_MASK = SES_STATUS_PAGE_INVOP_MASK 2085 | SES_STATUS_PAGE_INFO_MASK 2086 | SES_STATUS_PAGE_NON_CRIT_MASK 2087 | SES_STATUS_PAGE_CRIT_MASK 2088 | SES_STATUS_PAGE_UNRECOV_MASK, 2089 SES_STATUS_PAGE_CHANGED_SHIFT = 0, 2090 }; 2091 2092 #define GEN_SES_STATUS_PAGE_ACCESSORS(LCASE, UCASE) \ 2093 GEN_HDR_ACCESSORS(ses_status_page, SES_STATUS_PAGE, LCASE, UCASE) 2094 2095 GEN_SES_STATUS_PAGE_ACCESSORS(invop, INVOP) 2096 GEN_SES_STATUS_PAGE_ACCESSORS(info, INFO) 2097 GEN_SES_STATUS_PAGE_ACCESSORS(non_crit, NON_CRIT) 2098 GEN_SES_STATUS_PAGE_ACCESSORS(crit, CRIT) 2099 GEN_SES_STATUS_PAGE_ACCESSORS(unrecov, UNRECOV) 2100 GEN_SES_STATUS_PAGE_ACCESSORS(changed, CHANGED) 2101 #undef GEN_SES_STATUS_PAGE_ACCESSORS 2102 2103 /*================ SCSI SES Element Descriptor Diagnostic Page ===============*/ 2104 struct ses_elem_descr { 2105 uint8_t reserved[2]; 2106 uint8_t length[2]; 2107 char description[]; 2108 }; 2109 2110 struct ses_elem_descr_page { 2111 struct ses_page_hdr hdr; 2112 struct ses_elem_descr descrs[]; 2113 }; 2114 2115 /*============ SCSI SES Additional Element Status Diagnostic Page ============*/ 2116 struct ses_addl_elem_status_page { 2117 struct ses_page_hdr hdr; 2118 }; 2119 2120 /*====================== Legacy (Deprecated) Structures ======================*/ 2121 struct ses_control_page_hdr { 2122 uint8_t page_code; 2123 uint8_t control_flags; 2124 uint8_t length[2]; 2125 uint8_t gen_code[4]; 2126 /* Followed by variable length array of descriptors. */ 2127 }; 2128 2129 struct ses_status_page_hdr { 2130 uint8_t page_code; 2131 uint8_t status_flags; 2132 uint8_t length[2]; 2133 uint8_t gen_code[4]; 2134 /* Followed by variable length array of descriptors. */ 2135 }; 2136 2137 /* ses_page_hdr.reserved values */ 2138 /* 2139 * Enclosure Status Diagnostic Page: 2140 * uint8_t reserved : 3, 2141 * invop : 1, 2142 * info : 1, 2143 * noncritical : 1, 2144 * critical : 1, 2145 * unrecov : 1; 2146 */ 2147 #define SES_ENCSTAT_UNRECOV 0x01 2148 #define SES_ENCSTAT_CRITICAL 0x02 2149 #define SES_ENCSTAT_NONCRITICAL 0x04 2150 #define SES_ENCSTAT_INFO 0x08 2151 #define SES_ENCSTAT_INVOP 0x10 2152 /* Status mask: All of the above OR'd together */ 2153 #define SES_STATUS_MASK 0x1f 2154 #define SES_SET_STATUS_MASK 0xf 2155 /* Element Descriptor Diagnostic Page: unused */ 2156 /* Additional Element Status Diagnostic Page: unused */ 2157 2158 2159 2160 /* Summary SES Status Defines, Common Status Codes */ 2161 #define SES_OBJSTAT_UNSUPPORTED 0 2162 #define SES_OBJSTAT_OK 1 2163 #define SES_OBJSTAT_CRIT 2 2164 #define SES_OBJSTAT_NONCRIT 3 2165 #define SES_OBJSTAT_UNRECOV 4 2166 #define SES_OBJSTAT_NOTINSTALLED 5 2167 #define SES_OBJSTAT_UNKNOWN 6 2168 #define SES_OBJSTAT_NOTAVAIL 7 2169 #define SES_OBJSTAT_NOACCESS 8 2170 2171 /* 2172 * For control pages, cstat[0] is the same for the 2173 * enclosure and is common across all device types. 2174 * 2175 * If SESCTL_CSEL is set, then PRDFAIL, DISABLE and RSTSWAP 2176 * are checked, otherwise bits that are specific to the device 2177 * type in the other 3 bytes of cstat or checked. 2178 */ 2179 #define SESCTL_CSEL 0x80 2180 #define SESCTL_PRDFAIL 0x40 2181 #define SESCTL_DISABLE 0x20 2182 #define SESCTL_RSTSWAP 0x10 2183 2184 2185 /* Control bits, Device Elements, byte 2 */ 2186 #define SESCTL_DRVLCK 0x40 /* "DO NOT REMOVE" */ 2187 #define SESCTL_RQSINS 0x08 /* RQST INSERT */ 2188 #define SESCTL_RQSRMV 0x04 /* RQST REMOVE */ 2189 #define SESCTL_RQSID 0x02 /* RQST IDENT */ 2190 /* Control bits, Device Elements, byte 3 */ 2191 #define SESCTL_RQSFLT 0x20 /* RQST FAULT */ 2192 #define SESCTL_DEVOFF 0x10 /* DEVICE OFF */ 2193 2194 /* Control bits, Generic, byte 3 */ 2195 #define SESCTL_RQSTFAIL 0x40 2196 #define SESCTL_RQSTON 0x20 2197 2198 /* 2199 * Getting text for an object type is a little 2200 * trickier because it's string data that can 2201 * go up to 64 KBytes. Build this union and 2202 * fill the obj_id with the id of the object who's 2203 * help text you want, and if text is available, 2204 * obj_text will be filled in, null terminated. 2205 */ 2206 2207 typedef union { 2208 unsigned int obj_id; 2209 char obj_text[1]; 2210 } ses_hlptxt; 2211 2212 /*============================================================================*/ 2213 struct ses_elm_desc_hdr { 2214 uint8_t reserved[2]; 2215 uint8_t length[2]; 2216 }; 2217 2218 /* 2219 * SES v2 r20 6.1.13 - Element Additional Status diagnostic page 2220 * Tables 26-28 (general), 29-32 (FC), 33-41 (SAS) 2221 * 2222 * Protocol identifier uses definitions in scsi_all.h; 2223 * SPSP_PROTO_FC, SPSP_PROTO_SAS are the only ones used here. 2224 */ 2225 2226 struct ses_elm_fc_eip_hdr { 2227 uint8_t num_phys; 2228 uint8_t reserved[2]; 2229 uint8_t dev_slot_num; 2230 uint8_t node_name[8]; 2231 }; 2232 2233 struct ses_elm_fc_noneip_hdr { 2234 uint8_t num_phys; 2235 uint8_t reserved; 2236 uint8_t node_name[8]; 2237 }; 2238 2239 struct ses_elm_fc_base_hdr { 2240 uint8_t num_phys; 2241 }; 2242 2243 union ses_elm_fc_hdr { 2244 struct ses_elm_fc_base_hdr base_hdr; 2245 struct ses_elm_fc_eip_hdr eip_hdr; 2246 struct ses_elm_fc_noneip_hdr noneip_hdr; 2247 }; 2248 2249 struct ses_elm_fc_port { 2250 uint8_t port_loop_position; 2251 uint8_t bypass_reason; 2252 #define SES_FC_PORT_BYPASS_UNBYPASSED 0x00 2253 2254 #define SES_FC_PORT_BYPASS_LINKFAIL_RATE_TOO_HIGH 0x10 2255 #define SES_FC_PORT_BYPASS_SYNC_LOSS_RATE_TOO_HIGH 0x11 2256 #define SES_FC_PORT_BYPASS_SIGNAL_LOSS_RATE_TOO_HIGH 0x12 2257 #define SES_FC_PORT_BYPASS_SEQPROTO_ERR_RATE_TOO_HIGH 0x13 2258 #define SES_FC_PORT_BYPASS_INVAL_XMIT_RATE_TOO_HIGH 0x14 2259 #define SES_FC_PORT_BYPASS_CRC_ERR_RATE_TOO_HIGH 0x15 2260 2261 #define SES_FC_PORT_BYPASS_ERR_RATE_RESERVED_BEGIN 0x16 2262 #define SES_FC_PORT_BYPASS_ERR_RATE_RESERVED_END 0x1F 2263 2264 #define SES_FC_PORT_BYPASS_LINKFAIL_COUNT_TOO_HIGH 0x20 2265 #define SES_FC_PORT_BYPASS_SYNC_LOSS_COUNT_TOO_HIGH 0x21 2266 #define SES_FC_PORT_BYPASS_SIGNAL_LOSS_COUNT_TOO_HIGH 0x22 2267 #define SES_FC_PORT_BYPASS_SEQPROTO_ERR_COUNT_TOO_HIGH 0x23 2268 #define SES_FC_PORT_BYPASS_INVAL_XMIT_COUNT_TOO_HIGH 0x24 2269 #define SES_FC_PORT_BYPASS_CRC_ERR_COUNT_TOO_HIGH 0x25 2270 2271 #define SES_FC_PORT_BYPASS_ERR_COUNT_RESERVED_BEGIN 0x26 2272 #define SES_FC_PORT_BYPASS_ERR_COUNT_RESERVED_END 0x2F 2273 2274 #define SES_FC_PORT_BYPASS_RESERVED_BEGIN 0x30 2275 #define SES_FC_PORT_BYPASS_RESERVED_END 0xBF 2276 2277 #define SES_FC_PORT_BYPASS_VENDOR_SPECIFIC_BEGIN 0xC0 2278 #define SES_FC_PORT_BYPASS_VENDOR_SPECIFIC_END 0xFF 2279 uint8_t port_req_hard_addr; 2280 uint8_t n_port_id[3]; 2281 uint8_t n_port_name[8]; 2282 }; 2283 2284 struct ses_elm_sas_device_phy { 2285 uint8_t byte0; 2286 /* 2287 * uint8_t reserved0 : 1, 2288 * uint8_t device_type : 3, 2289 * uint8_t reserved1 : 4; 2290 */ 2291 2292 uint8_t reserved0; 2293 2294 /* Bit positions for initiator and target port protocols */ 2295 #define SES_SASOBJ_DEV_PHY_SMP 0x2 2296 #define SES_SASOBJ_DEV_PHY_STP 0x4 2297 #define SES_SASOBJ_DEV_PHY_SSP 0x8 2298 /* Select all of the above protocols */ 2299 #define SES_SASOBJ_DEV_PHY_PROTOMASK 0xe 2300 uint8_t initiator_ports; 2301 /* 2302 * uint8_t reserved0 : 4, 2303 * uint8_t ssp : 1, 2304 * uint8_t stp : 1, 2305 * uint8_t smp : 1, 2306 * uint8_t reserved1 : 3; 2307 */ 2308 uint8_t target_ports; 2309 /* 2310 * uint8_t sata_port_selector : 1, 2311 * uint8_t reserved : 3, 2312 * uint8_t ssp : 1, 2313 * uint8_t stp : 1, 2314 * uint8_t smp : 1, 2315 * uint8_t sata_device : 1; 2316 */ 2317 uint8_t parent_addr[8]; /* SAS address of parent */ 2318 uint8_t phy_addr[8]; /* SAS address of this phy */ 2319 uint8_t phy_id; 2320 uint8_t reserved1[7]; 2321 }; 2322 #ifdef _KERNEL 2323 int ses_elm_sas_dev_phy_sata_dev(struct ses_elm_sas_device_phy *); 2324 int ses_elm_sas_dev_phy_sata_port(struct ses_elm_sas_device_phy *); 2325 int ses_elm_sas_dev_phy_dev_type(struct ses_elm_sas_device_phy *); 2326 #endif /* _KERNEL */ 2327 2328 struct ses_elm_sas_expander_phy { 2329 uint8_t connector_index; 2330 uint8_t other_index; 2331 }; 2332 2333 struct ses_elm_sas_port_phy { 2334 uint8_t phy_id; 2335 uint8_t reserved; 2336 uint8_t connector_index; 2337 uint8_t other_index; 2338 uint8_t phy_addr[8]; 2339 }; 2340 2341 struct ses_elm_sas_type0_base_hdr { 2342 uint8_t num_phys; 2343 uint8_t byte1; 2344 /* 2345 * uint8_t descriptor_type : 2, 2346 * uint8_t reserved : 5, 2347 * uint8_t not_all_phys : 1; 2348 */ 2349 #define SES_SASOBJ_TYPE0_NOT_ALL_PHYS(obj) \ 2350 ((obj)->byte1 & 0x1) 2351 }; 2352 2353 struct ses_elm_sas_type0_eip_hdr { 2354 struct ses_elm_sas_type0_base_hdr base; 2355 uint8_t reserved; 2356 uint8_t dev_slot_num; 2357 }; 2358 2359 struct ses_elm_sas_type1_expander_hdr { 2360 uint8_t num_phys; 2361 uint8_t byte1; 2362 /* 2363 * uint8_t descriptor_type : 2, 2364 * uint8_t reserved : 6; 2365 */ 2366 uint8_t reserved[2]; 2367 uint8_t sas_addr[8]; 2368 }; 2369 2370 struct ses_elm_sas_type1_nonexpander_hdr { 2371 uint8_t num_phys; 2372 uint8_t byte1; 2373 /* 2374 * uint8_t descriptor_type : 2, 2375 * uint8_t reserved : 6; 2376 */ 2377 uint8_t reserved[2]; 2378 }; 2379 2380 /* NB: This is only usable for as long as the headers happen to match */ 2381 struct ses_elm_sas_base_hdr { 2382 uint8_t num_phys; 2383 uint8_t byte1; 2384 /* 2385 * uint8_t descriptor_type : 2, 2386 * uint8_t descr_specific : 6; 2387 */ 2388 #define SES_SASOBJ_TYPE_SLOT 0 2389 #define SES_SASOBJ_TYPE_OTHER 1 2390 }; 2391 2392 union ses_elm_sas_hdr { 2393 struct ses_elm_sas_base_hdr base_hdr; 2394 struct ses_elm_sas_type0_base_hdr type0_noneip; 2395 struct ses_elm_sas_type0_eip_hdr type0_eip; 2396 struct ses_elm_sas_type1_expander_hdr type1_exp; 2397 struct ses_elm_sas_type1_nonexpander_hdr type1_nonexp; 2398 }; 2399 int ses_elm_sas_type0_not_all_phys(union ses_elm_sas_hdr *); 2400 int ses_elm_sas_descr_type(union ses_elm_sas_hdr *); 2401 2402 struct ses_elm_addlstatus_base_hdr { 2403 uint8_t byte0; 2404 /* 2405 * uint8_t invalid : 1, 2406 * uint8_t reserved : 2, 2407 * uint8_t eip : 1, 2408 * uint8_t proto_id : 4; 2409 */ 2410 uint8_t length; 2411 }; 2412 int ses_elm_addlstatus_proto(struct ses_elm_addlstatus_base_hdr *); 2413 int ses_elm_addlstatus_eip(struct ses_elm_addlstatus_base_hdr *); 2414 int ses_elm_addlstatus_invalid(struct ses_elm_addlstatus_base_hdr *); 2415 2416 struct ses_elm_addlstatus_eip_hdr { 2417 struct ses_elm_addlstatus_base_hdr base; 2418 uint8_t byte2; 2419 #define SES_ADDL_EIP_EIIOE 1 2420 uint8_t element_index; 2421 /* NB: This define (currently) applies to all eip=1 headers */ 2422 #define SES_EIP_HDR_EXTRA_LEN 2 2423 }; 2424 2425 union ses_elm_addlstatus_descr_hdr { 2426 struct ses_elm_addlstatus_base_hdr base; 2427 struct ses_elm_addlstatus_eip_hdr eip; 2428 }; 2429 2430 union ses_elm_addlstatus_proto_hdr { 2431 union ses_elm_fc_hdr fc; 2432 union ses_elm_sas_hdr sas; 2433 }; 2434 2435 /*============================= Namespace Cleanup ============================*/ 2436 #undef GEN_HDR_ACCESSORS 2437 #undef GEN_ACCESSORS 2438 #undef GEN_HDR_SETTER 2439 #undef GEN_HDR_GETTER 2440 #undef GEN_SETTER 2441 #undef GEN_GETTER 2442 #undef MK_ENUM 2443 2444 #endif /* _SCSI_SES_H_ */ 2445