1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #ifndef _SCSI_SAFTE_H_
20 #define _SCSI_SAFTE_H_
21
22 #define SAFTE_EXTRA_OFFSET 0x05
23
24 struct safte_inq {
25 u_int8_t uniqueid[7];
26 u_int8_t chanid;
27 u_int8_t ident[6];
28 #define SAFTE_IDENT "SAF-TE"
29 u_int8_t revision[4];
30 #ifdef notyet
31 u_int8_t reserved[2];
32 #endif
33 } __packed;
34 #define SAFTE_INQ_LEN 54
35
36 struct safte_readbuf_cmd {
37 u_int8_t opcode;
38 u_int8_t flags;
39 #define SAFTE_RD_LUNMASK 0xe0
40 #define SAFTE_RD_MODEMASK 0x07
41 #define SAFTE_RD_MODE 0x01
42 u_int8_t bufferid;
43 #define SAFTE_RD_CONFIG 0x00
44 #define SAFTE_RD_ENCSTAT 0x01
45 #define SAFTE_RD_USAGE 0x02
46 #define SAFTE_RD_INSERTS 0x03
47 #define SAFTE_RD_SLOTSTAT 0x04
48 #define SAFTE_RD_GLOBALS 0x05
49 u_int32_t reserved1;
50 u_int16_t length;
51 u_int8_t reserved2;
52 } __packed;
53
54 struct safte_writebuf_cmd {
55 u_int8_t opcode;
56 u_int8_t flags;
57 #define SAFTE_WR_LUNMASK 0xe0
58 #define SAFTE_WR_MODEMASK 0x07
59 #define SAFTE_WR_MODE 0x01
60 u_int8_t reserved1[5];
61 u_int16_t length;
62 u_int8_t reserved2;
63 } __packed;
64
65 #define SAFTE_WRITE_SLOTSTAT 0x10
66 #define SAFTE_WRITE_SETID 0x11
67 #define SAFTE_WRITE_SLOTOP 0x12
68 #define SAFTE_WRITE_FANSPEED 0x13
69 #define SAFTE_WRITE_PWRSUP 0x14
70 #define SAFTE_WRITE_GLOBALS 0x15
71
72
73
74 struct safte_config {
75 u_int8_t nfans;
76 u_int8_t npwrsup;
77 u_int8_t nslots;
78 u_int8_t doorlock;
79 u_int8_t ntemps;
80 u_int8_t alarm;
81 u_int8_t therm;
82 #define SAFTE_CFG_CELSIUSMASK 0x80
83 #define SAFTE_CFG_CELSIUS(a) ((a) & SAFTE_CFG_CELSIUSMASK ? 1 : 0)
84 #define SAFTE_CFG_NTHERMMASK 0x0f
85 #define SAFTE_CFG_NTHERM(a) ((a) & SAFTE_CFG_NTHERMMASK)
86 u_int8_t reserved[56];
87 u_int8_t vendor_bytes;
88 } __packed;
89 #define SAFTE_CONFIG_LEN sizeof(struct safte_config)
90
91
92
93 #define SAFTE_FAN_OP 0x00
94 #define SAFTE_FAN_MF 0x01
95 #define SAFTE_FAN_NOTINST 0x02
96 #define SAFTE_FAN_UNKNOWN 0x80
97
98
99 #define SAFTE_PWR_OP_ON 0x00
100 #define SAFTE_PWR_OP_OFF 0x01
101 #define SAFTE_PWR_MF_ON 0x10
102 #define SAFTE_PWR_MF_OFF 0x11
103 #define SAFTE_PWR_NOTINST 0x20
104 #define SAFTE_PWR_PRESENT 0x21
105 #define SAFTE_PWR_UNKNOWN 0x80
106
107
108
109
110
111 #define SAFTE_DOOR_LOCKED 0x00
112 #define SAFTE_DOOR_UNLOCKED 0x01
113 #define SAFTE_DOOR_UNKNOWN 0x80
114
115
116 #define SAFTE_SPKR_OFF 0x00
117 #define SAFTE_SPKR_ON 0x01
118
119
120 #define SAFTE_TEMP_OFFSET -10
121
122
123 #define SAFTE_TEMP_ETA 0x8000
124
125
126
127 struct safte_usage {
128 u_int32_t minutes;
129 u_int32_t cycles;
130 u_int8_t reserved[7];
131 u_int8_t vendor_bytes;
132 };
133
134
135
136
137
138
139
140 #define SAFTE_SLOTSTAT_INSERT (1<<0)
141 #define SAFTE_SLOTSTAT_SWAP (1<<1)
142 #define SAFTE_SLOTSTAT_OPER (1<<2)
143
144
145
146 struct safte_globals {
147 u_int8_t flags1;
148 #define SAFTE_GLOBAL_ALARM (1<<0)
149 #define SAFTE_GLOBAL_FAILURE (1<<1)
150 #define SAFTE_GLOBAL_WARNING (1<<2)
151 #define SAFTE_GLOBAL_POWER (1<<3)
152 #define SAFTE_GLOBAL_COOLING (1<<4)
153 #define SAFTE_GLOBAL_PWRFAIL (1<<5)
154 #define SAFTE_GLOBAL_DRVFAIL (1<<6)
155 #define SAFTE_GLOBAL_DRVWARN (1<<6)
156 u_int8_t flags2;
157 #define SAFTE_GLOBAL_ARRAYFAIL (1<<0)
158 #define SAFTE_GLOBAL_ARRAYWARN (1<<1)
159 #define SAFTE_GLOBAL_LOCK (1<<2)
160 #define SAFTE_GLOBAL_IDENTIFY (1<<3)
161 u_int8_t flags3;
162 u_int8_t reserved[13];
163 };
164
165
166
167 struct safte_slotop {
168 u_int8_t opcode;
169 u_int8_t slot;
170 u_int8_t flags;
171 #define SAFTE_SLOTOP_OPERATE (1<<0)
172 #define SAFTE_SLOTOP_INSREM (1<<1)
173 #define SAFTE_SLOTOP_IDENTIFY (1<<2)
174 u_int8_t reserved[61];
175 } __packed;
176
177 #endif