3 * Copyright (c) 2000 by Matthew Jacob
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions, and the following disclaimer,
11 * without modification, immediately at the beginning of the file.
12 * 2. The name of the author may not be used to endorse or promote products
13 * derived from this software without specific prior written permission.
15 * Alternatively, this software may be distributed under the terms of the
16 * the GNU Public License ("GPL").
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
22 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 #include <sys/types.h>
41 #include <cam/scsi/scsi_enc.h>
47 * offset by +20 degrees.
48 * The range of the value expresses a temperature between -19 and +235 degrees
49 * Celsius. A value of 00h is reserved.
51 #define TEMPERATURE_OFFSET 20
56 static char rbuf[132];
59 case ELMTYP_UNSPECIFIED:
60 return ("Unspecified");
62 return ("Device Slot");
64 return ("Power Supply");
68 return ("Temperature Sensor");
72 return ("Audible Alarm");
74 return ("Enclosure Services Controller Electronics");
76 return ("SCC Controller Electronics");
78 return ("Nonvolatile Cache");
79 case ELMTYP_INV_OP_REASON:
80 return ("Invalid Operation Reason");
82 return ("Uninterruptible Power Supply");
86 return ("Key Pad Entry");
87 case ELMTYP_ENCLOSURE:
90 return ("SCSI Port/Transceiver");
94 return ("Communication Port");
96 return ("Voltage Sensor");
98 return ("Current Sensor");
100 return ("SCSI Target Port");
101 case ELMTYP_SCSI_INI:
102 return ("SCSI Initiator Port");
104 return ("Simple Subenclosure");
105 case ELMTYP_ARRAY_DEV:
106 return ("Array Device Slot");
108 return ("SAS Expander");
109 case ELMTYP_SAS_CONN:
110 return ("SAS Connector");
112 snprintf(rbuf, sizeof(rbuf), "<Type 0x%x>", type);
118 scode2ascii(u_char code)
120 static char rbuf[32];
121 switch (code & 0xf) {
122 case SES_OBJSTAT_UNSUPPORTED:
123 return ("Unsupported");
126 case SES_OBJSTAT_CRIT:
128 case SES_OBJSTAT_NONCRIT:
129 return ("Noncritical");
130 case SES_OBJSTAT_UNRECOV:
131 return ("Unrecoverable");
132 case SES_OBJSTAT_NOTINSTALLED:
133 return ("Not Installed");
134 case SES_OBJSTAT_UNKNOWN:
136 case SES_OBJSTAT_NOTAVAIL:
137 return ("Not Available");
138 case SES_OBJSTAT_NOACCESS:
139 return ("No Access Allowed");
141 snprintf(rbuf, sizeof(rbuf), "<Status 0x%x>", code & 0xf);