1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _SYS_SESIO_H 27 #define _SYS_SESIO_H 28 29 /* 30 * Enclosure Services Interface Structures 31 */ 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 /* 38 * Data Structures and definitions for SES Applications 39 */ 40 41 typedef struct { 42 unsigned int obj_id; /* Object Identifier */ 43 unsigned int : 16, /* reserved */ 44 subencid : 8, /* SubEnclosure ID */ 45 elem_type : 8; /* Element Type */ 46 } ses_object; 47 48 /* Known Enclosure Types */ 49 #define SESTYP_UNSPECIFIED 0x00 50 #define SESTYP_DEVICE 0x01 51 #define SESTYP_POWER 0x02 52 #define SESTYP_FAN 0x03 53 #define SESTYP_THERM 0x04 54 #define SESTYP_DOORLOCK 0x05 55 #define SESTYP_ALARM 0x06 56 #define SESTYP_ESCC 0x07 /* Enclosure SCC */ 57 #define SESTYP_SCC 0x08 /* SCC */ 58 #define SESTYP_NVRAM 0x09 59 #define SESTYP_UPS 0x0b 60 #define SESTYP_DISPLAY 0x0c 61 #define SESTYP_KEYPAD 0x0d 62 #define SESTYP_SCSIXVR 0x0f 63 #define SESTYP_LANGUAGE 0x10 64 #define SESTYP_COMPORT 0x11 65 #define SESTYP_VOM 0x12 66 #define SESTYP_AMMETER 0x13 67 #define SESTYP_SCSI_TGT 0x14 68 #define SESTYP_SCSI_INI 0x15 69 #define SESTYP_SUBENC 0x16 70 #define SESTYP_ARRAY 0x17 /* SES2r19 #7.1 */ 71 #define SESTYP_SASEXPANDER 0x18 /* SES2r19 #7.1 */ 72 #define SESTYP_SASCONNECTOR 0x19 /* SES2r19 #7.1 */ 73 74 75 /* 76 * Overall Enclosure Status 77 */ 78 #define ENCSTAT_UNRECOV 0x1 79 #define ENCSTAT_CRITICAL 0x2 80 #define ENCSTAT_NONCRITICAL 0x4 81 #define ENCSTAT_INFO 0x8 82 83 typedef struct { 84 uint_t obj_id; 85 uchar_t cstat[4]; 86 } ses_objarg; 87 88 /* Summary SES Status Defines, Common Status Codes */ 89 #define SESSTAT_UNSUPPORTED 0 90 #define SESSTAT_OK 1 91 #define SESSTAT_CRIT 2 92 #define SESSTAT_NONCRIT 3 93 #define SESSTAT_UNRECOV 4 94 #define SESSTAT_NOTINSTALLED 5 95 #define SESSTAT_UNKNOWN 6 96 #define SESSTAT_NOTAVAIL 7 97 98 /* 99 * For control pages, cstat[0] is the same for the 100 * enclosure and is common across all device types. 101 * 102 * If SESCTL_CSEL is set, then PRDFAIL, DISABLE and RSTSWAP 103 * are checked, otherwise bits that are specific to the device 104 * type in the other 3 bytes of cstat or checked. 105 */ 106 #define SESCTL_CSEL 0x80 107 #define SESCTL_PRDFAIL 0x40 108 #define SESCTL_DISABLE 0x20 109 #define SESCTL_RSTSWAP 0x10 110 111 112 /* Control bits, Device Elements, byte 2 */ 113 #define SESCTL_DRVLCK 0x40 /* "DO NOT REMOVE" */ 114 #define SESCTL_RQSINS 0x08 /* RQST INSERT */ 115 #define SESCTL_RQSRMV 0x04 /* RQST REMOVE */ 116 #define SESCTL_RQSID 0x02 /* RQST IDENT */ 117 /* Control bits, Device Elements, byte 3 */ 118 #define SESCTL_RQSFLT 0x20 /* RQST FAULT */ 119 #define SESCTL_DEVOFF 0x10 /* DEVICE OFF */ 120 121 /* Control bits, Generic, byte 3 */ 122 #define SESCTL_RQSTFAIL 0x40 123 #define SESCTL_RQSTON 0x20 124 125 126 /* 127 * SES Driver ioctls 128 */ 129 #define SESIOC ('e'<<8) 130 #define SESIOC_IOCTL_GETSTATE (SESIOC|1) /* get esi status */ 131 #define SESIOC_IOCTL_SETSTATE (SESIOC|2) /* set esi state */ 132 #define SESIOC_IOCTL_INQUIRY (SESIOC|3) /* get SCSI Inquiry info */ 133 #define SESIOC_GETNOBJ (SESIOC|10) 134 #define SESIOC_GETOBJMAP (SESIOC|11) 135 #define SESIOC_INIT (SESIOC|12) 136 #define SESIOC_GETENCSTAT (SESIOC|13) 137 #define SESIOC_SETENCSTAT (SESIOC|14) 138 #define SESIOC_GETOBJSTAT (SESIOC|15) 139 #define SESIOC_SETOBJSTAT (SESIOC|16) 140 141 /* 142 * The following structure is used by the SES_IOCTL_GETSTATE 143 * and the SES_IOCTL_SETSTATE ioctls 144 */ 145 struct ses_ioctl { 146 uint32_t page_size; /* Size of page to be read/written */ 147 uint8_t page_code; /* Page to be read/written */ 148 caddr_t page; /* Address of page to be read/written */ 149 }; 150 151 152 #ifdef __cplusplus 153 } 154 #endif 155 156 #endif /* _SYS_SESIO_H */ 157