mlxreg.h revision 1.3 1 1.3 ad /* $NetBSD: mlxreg.h,v 1.3 2001/07/26 12:38:03 ad Exp $ */
2 1.1 ad
3 1.1 ad /*-
4 1.1 ad * Copyright (c) 2001 The NetBSD Foundation, Inc.
5 1.1 ad * All rights reserved.
6 1.1 ad *
7 1.1 ad * This code is derived from software contributed to The NetBSD Foundation
8 1.1 ad * by Andrew Doran.
9 1.1 ad *
10 1.1 ad * Redistribution and use in source and binary forms, with or without
11 1.1 ad * modification, are permitted provided that the following conditions
12 1.1 ad * are met:
13 1.1 ad * 1. Redistributions of source code must retain the above copyright
14 1.1 ad * notice, this list of conditions and the following disclaimer.
15 1.1 ad * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 ad * notice, this list of conditions and the following disclaimer in the
17 1.1 ad * documentation and/or other materials provided with the distribution.
18 1.1 ad * 3. All advertising materials mentioning features or use of this software
19 1.1 ad * must display the following acknowledgement:
20 1.1 ad * This product includes software developed by the NetBSD
21 1.1 ad * Foundation, Inc. and its contributors.
22 1.1 ad * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1 ad * contributors may be used to endorse or promote products derived
24 1.1 ad * from this software without specific prior written permission.
25 1.1 ad *
26 1.1 ad * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1 ad * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1 ad * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1 ad * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1 ad * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1 ad * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1 ad * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1 ad * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1 ad * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1 ad * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1 ad * POSSIBILITY OF SUCH DAMAGE.
37 1.1 ad */
38 1.1 ad
39 1.1 ad /*-
40 1.1 ad * Copyright (c) 1999 Michael Smith
41 1.1 ad * All rights reserved.
42 1.1 ad *
43 1.1 ad * Redistribution and use in source and binary forms, with or without
44 1.1 ad * modification, are permitted provided that the following conditions
45 1.1 ad * are met:
46 1.1 ad * 1. Redistributions of source code must retain the above copyright
47 1.1 ad * notice, this list of conditions and the following disclaimer.
48 1.1 ad * 2. Redistributions in binary form must reproduce the above copyright
49 1.1 ad * notice, this list of conditions and the following disclaimer in the
50 1.1 ad * documentation and/or other materials provided with the distribution.
51 1.1 ad *
52 1.1 ad * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
53 1.1 ad * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 1.1 ad * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55 1.1 ad * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
56 1.1 ad * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 1.1 ad * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58 1.1 ad * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 1.1 ad * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 1.1 ad * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 1.1 ad * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 1.1 ad * SUCH DAMAGE.
63 1.1 ad *
64 1.1 ad * from FreeBSD: mlxreg.h,v 1.5.2.2 2000/04/24 19:40:50 msmith Exp
65 1.1 ad */
66 1.1 ad
67 1.1 ad #ifndef _IC_MLXREG_H_
68 1.1 ad #define _IC_MLXREG_H_
69 1.1 ad
70 1.1 ad #define MLX_SECTOR_SIZE 512
71 1.1 ad
72 1.1 ad /*
73 1.1 ad * Selected command codes.
74 1.1 ad */
75 1.1 ad #define MLX_CMD_ENQUIRY_OLD 0x05
76 1.1 ad #define MLX_CMD_ENQUIRY 0x53
77 1.1 ad #define MLX_CMD_ENQUIRY2 0x1c
78 1.1 ad #define MLX_CMD_ENQSYSDRIVE 0x19
79 1.1 ad #define MLX_CMD_READSG 0xb6
80 1.1 ad #define MLX_CMD_WRITESG 0xb7
81 1.1 ad #define MLX_CMD_READSG_OLD 0x82
82 1.1 ad #define MLX_CMD_WRITESG_OLD 0x83
83 1.1 ad #define MLX_CMD_FLUSH 0x0a
84 1.1 ad #define MLX_CMD_LOGOP 0x72
85 1.1 ad #define MLX_CMD_REBUILDASYNC 0x16
86 1.1 ad #define MLX_CMD_CHECKASYNC 0x1e
87 1.1 ad #define MLX_CMD_REBUILDSTAT 0x0c
88 1.1 ad #define MLX_CMD_STOPCHANNEL 0x13
89 1.1 ad #define MLX_CMD_STARTCHANNEL 0x12
90 1.1 ad #define MLX_CMD_READ_CONFIG 0x4e
91 1.1 ad #define MLX_CMD_WRITE_CONFIG 0x4f
92 1.1 ad #define MLX_CMD_READ_DK_CONFIG 0x4a
93 1.1 ad #define MLX_CMD_WRITE_DK_CONFIG 0x4b
94 1.1 ad #define MLX_CMD_DIRECT_CDB 0x04
95 1.1 ad #define MLX_CMD_DEVICE_STATE 0x50
96 1.1 ad #define MLX_CMD_READ_CONFIG2 0x3d
97 1.1 ad #define MLX_CMD_WRITE_CONFIG2 0x3c
98 1.1 ad
99 1.1 ad #ifdef _KERNEL
100 1.1 ad
101 1.1 ad /*
102 1.1 ad * Status values.
103 1.1 ad */
104 1.1 ad #define MLX_STATUS_OK 0x0000
105 1.1 ad #define MLX_STATUS_RDWROFFLINE 0x0002 /* read/write claims drive is offline */
106 1.1 ad #define MLX_STATUS_WEDGED 0xdeaf /* controller not listening */
107 1.1 ad #define MLX_STATUS_LOST 0xdead /* never came back */
108 1.3 ad #define MLX_STATUS_BUSY 0xbabe /* command is in controller */
109 1.1 ad
110 1.1 ad /*
111 1.1 ad * V1 (EISA) interface.
112 1.1 ad */
113 1.1 ad #define MLX_V1REG_IE 0x09
114 1.1 ad #define MLX_V1REG_IDB 0x0d
115 1.1 ad #define MLX_V1REG_ODB_EN 0x0e
116 1.1 ad #define MLX_V1REG_ODB 0x0f
117 1.1 ad #define MLX_V1REG_MAILBOX 0x10
118 1.1 ad
119 1.1 ad #define MLX_V1_IDB_FULL 0x01 /* mailbox is full */
120 1.1 ad #define MLX_V1_IDB_INIT_BUSY 0x02 /* init in progress */
121 1.1 ad
122 1.1 ad #define MLX_V1_IDB_SACK 0x02 /* acknowledge status read */
123 1.2 ad #define MLX_V1_IDB_RESET 0x10 /* reset controller */
124 1.1 ad
125 1.1 ad #define MLX_V1_ODB_SAVAIL 0x01 /* status is available */
126 1.2 ad #define MLX_V1_ODB_RESET 0x02 /* reset controller */
127 1.1 ad
128 1.1 ad #define MLX_V1_FWERROR_PEND 0x04 /* firmware error pending */
129 1.1 ad
130 1.1 ad #define MLX_V1_MAILBOX_LEN 13
131 1.1 ad
132 1.1 ad /*
133 1.1 ad * V2/V3 interface.
134 1.1 ad */
135 1.1 ad #define MLX_V3REG_MAILBOX 0x00
136 1.1 ad #define MLX_V3REG_STATUS_IDENT 0x0d
137 1.1 ad #define MLX_V3REG_STATUS 0x0e
138 1.1 ad #define MLX_V3REG_IDB 0x40
139 1.1 ad #define MLX_V3REG_ODB 0x41
140 1.1 ad #define MLX_V3REG_IE 0x43
141 1.1 ad #define MLX_V3REG_FWERROR 0x3f
142 1.1 ad #define MLX_V3REG_FWERROR_PARAM1 0x00
143 1.1 ad #define MLX_V3REG_FWERROR_PARAM2 0x01
144 1.1 ad
145 1.1 ad #define MLX_V3_IDB_FULL 0x01 /* mailbox is full */
146 1.1 ad #define MLX_V3_IDB_INIT_BUSY 0x02 /* init in progress */
147 1.1 ad
148 1.1 ad #define MLX_V3_IDB_SACK 0x02 /* acknowledge status read */
149 1.2 ad #define MLX_V3_IDB_RESET 0x08 /* reset controller */
150 1.1 ad
151 1.1 ad #define MLX_V3_ODB_SAVAIL 0x01 /* status is available */
152 1.1 ad
153 1.1 ad #define MLX_V3_FWERROR_PEND 0x04 /* firmware error pending */
154 1.1 ad
155 1.1 ad #define MLX_V3_MAILBOX_LEN 13
156 1.1 ad
157 1.1 ad /*
158 1.1 ad * V4 interface.
159 1.1 ad */
160 1.1 ad #define MLX_V4REG_MAILBOX 0x1000
161 1.1 ad #define MLX_V4REG_STATUS_IDENT 0x1018
162 1.1 ad #define MLX_V4REG_STATUS 0x101a
163 1.1 ad #define MLX_V4REG_IDB 0x0020
164 1.1 ad #define MLX_V4REG_ODB 0x002c
165 1.1 ad #define MLX_V4REG_IE 0x0034
166 1.1 ad #define MLX_V4REG_FWERROR 0x103f
167 1.1 ad #define MLX_V4REG_FWERROR_PARAM1 0x1000
168 1.1 ad #define MLX_V4REG_FWERROR_PARAM2 0x1001
169 1.1 ad
170 1.1 ad #define MLX_V4_IDB_FULL 0x01 /* mailbox is full */
171 1.1 ad #define MLX_V4_IDB_INIT_BUSY 0x02 /* initialisation in progress */
172 1.1 ad
173 1.1 ad #define MLX_V4_IDB_HWMBOX_CMD 0x01 /* posted hardware mailbox command */
174 1.1 ad #define MLX_V4_IDB_SACK 0x02 /* acknowledge status read */
175 1.1 ad #define MLX_V4_IDB_MEMMBOX_CMD 0x10 /* posted memory mailbox command */
176 1.1 ad
177 1.1 ad #define MLX_V4_ODB_HWSAVAIL 0x01 /* status available for hardware m/b */
178 1.1 ad #define MLX_V4_ODB_MEMSAVAIL 0x02 /* status available for memory m/b */
179 1.1 ad
180 1.1 ad #define MLX_V4_ODB_HWMBOX_ACK 0x01 /* ack status read from hardware m/b */
181 1.1 ad #define MLX_V4_ODB_MEMMBOX_ACK 0x02 /* ack status read from memory m/b */
182 1.1 ad
183 1.1 ad #define MLX_V4_IE_MASK 0xfb /* message unit interrupt mask */
184 1.1 ad #define MLX_V4_IE_DISINT 0x04 /* interrupt disable bit */
185 1.1 ad
186 1.1 ad #define MLX_V4_FWERROR_PEND 0x04 /* firmware error pending */
187 1.1 ad
188 1.1 ad #define MLX_V4_MAILBOX_LEN 16
189 1.1 ad
190 1.1 ad /*
191 1.1 ad * V5 interface.
192 1.1 ad */
193 1.1 ad #define MLX_V5REG_MAILBOX 0x50
194 1.1 ad #define MLX_V5REG_STATUS_IDENT 0x5d
195 1.1 ad #define MLX_V5REG_STATUS 0x5e
196 1.1 ad #define MLX_V5REG_IDB 0x60
197 1.1 ad #define MLX_V5REG_ODB 0x61
198 1.1 ad #define MLX_V5REG_IE 0x34
199 1.1 ad #define MLX_V5REG_FWERROR 0x63
200 1.1 ad #define MLX_V5REG_FWERROR_PARAM1 0x50
201 1.1 ad #define MLX_V5REG_FWERROR_PARAM2 0x51
202 1.1 ad
203 1.1 ad #define MLX_V5_IDB_EMPTY 0x01 /* mailbox is empty */
204 1.1 ad #define MLX_V5_IDB_INIT_DONE 0x02 /* initialisation has completed */
205 1.1 ad
206 1.1 ad #define MLX_V5_IDB_HWMBOX_CMD 0x01 /* posted hardware mailbox command */
207 1.1 ad #define MLX_V5_IDB_SACK 0x02 /* acknowledge status read */
208 1.1 ad #define MLX_V5_IDB_RESET 0x08 /* reset request */
209 1.1 ad #define MLX_V5_IDB_MEMMBOX_CMD 0x10 /* posted memory mailbox command */
210 1.1 ad
211 1.1 ad #define MLX_V5_ODB_HWSAVAIL 0x01 /* status available for hardware m/b */
212 1.1 ad #define MLX_V5_ODB_MEMSAVAIL 0x02 /* status available for memory m/b */
213 1.1 ad
214 1.1 ad #define MLX_V5_ODB_HWMBOX_ACK 0x01 /* ack status read from hardware m/b */
215 1.1 ad #define MLX_V5_ODB_MEMMBOX_ACK 0x02 /* ack status read from memory m/b */
216 1.1 ad
217 1.1 ad #define MLX_V5_IE_DISINT 0x04 /* interrupt disable bit */
218 1.1 ad
219 1.1 ad #define MLX_V5_FWERROR_PEND 0x04 /* firmware error pending */
220 1.1 ad
221 1.1 ad #define MLX_V5_MAILBOX_LEN 16
222 1.1 ad
223 1.1 ad #endif /* _KERNEL */
224 1.1 ad
225 1.1 ad /*
226 1.1 ad * Scatter-gather list format, type 1, kind 00.
227 1.1 ad */
228 1.1 ad struct mlx_sgentry {
229 1.1 ad u_int32_t sge_addr;
230 1.1 ad u_int32_t sge_count;
231 1.1 ad } __attribute__ ((packed));
232 1.1 ad
233 1.1 ad /*
234 1.1 ad * Command result buffers, as placed in system memory by the controller.
235 1.1 ad */
236 1.1 ad struct mlx_enquiry_old {
237 1.1 ad u_int8_t me_num_sys_drvs;
238 1.1 ad u_int8_t me_res1[3];
239 1.1 ad u_int32_t me_drvsize[8];
240 1.1 ad u_int16_t me_flash_age;
241 1.1 ad u_int8_t me_status_flags;
242 1.1 ad u_int8_t me_free_state_change_count;
243 1.1 ad u_int8_t me_fwminor;
244 1.1 ad u_int8_t me_fwmajor;
245 1.1 ad u_int8_t me_rebuild_flag;
246 1.1 ad u_int8_t me_max_commands;
247 1.1 ad u_int8_t me_offline_sd_count;
248 1.1 ad u_int8_t me_res3;
249 1.1 ad u_int8_t me_critical_sd_count;
250 1.1 ad u_int8_t me_res4[3];
251 1.1 ad u_int8_t me_dead_count;
252 1.1 ad u_int8_t me_res5;
253 1.1 ad u_int8_t me_rebuild_count;
254 1.1 ad u_int8_t me_misc_flags;
255 1.1 ad struct {
256 1.1 ad u_int8_t dd_targ;
257 1.1 ad u_int8_t dd_chan;
258 1.1 ad } __attribute__ ((packed)) me_dead[20];
259 1.1 ad } __attribute__ ((packed));
260 1.1 ad
261 1.1 ad struct mlx_enquiry {
262 1.1 ad u_int8_t me_num_sys_drvs;
263 1.1 ad u_int8_t me_res1[3];
264 1.1 ad u_int32_t me_drvsize[32];
265 1.1 ad u_int16_t me_flash_age;
266 1.1 ad u_int8_t me_status_flags;
267 1.1 ad #define MLX_ENQ_SFLAG_DEFWRERR 0x01 /* deferred write error indicator */
268 1.1 ad #define MLX_ENQ_SFLAG_BATTLOW 0x02 /* battery low */
269 1.1 ad u_int8_t me_res2;
270 1.1 ad u_int8_t me_fwminor;
271 1.1 ad u_int8_t me_fwmajor;
272 1.1 ad u_int8_t me_rebuild_flag;
273 1.1 ad u_int8_t me_max_commands;
274 1.1 ad u_int8_t me_offline_sd_count;
275 1.1 ad u_int8_t me_res3;
276 1.1 ad u_int16_t me_event_log_seq_num;
277 1.1 ad u_int8_t me_critical_sd_count;
278 1.1 ad u_int8_t me_res4[3];
279 1.1 ad u_int8_t me_dead_count;
280 1.1 ad u_int8_t me_res5;
281 1.1 ad u_int8_t me_rebuild_count;
282 1.1 ad u_int8_t me_misc_flags;
283 1.1 ad #define MLX_ENQ_MISC_BBU 0x08 /* battery backup present */
284 1.1 ad struct {
285 1.1 ad u_int8_t dd_targ;
286 1.1 ad u_int8_t dd_chan;
287 1.1 ad } __attribute__ ((packed)) me_dead[20];
288 1.1 ad } __attribute__ ((packed));
289 1.1 ad
290 1.1 ad struct mlx_enquiry2 {
291 1.1 ad u_int8_t me_hardware_id[4];
292 1.1 ad u_int8_t me_firmware_id[4];
293 1.1 ad u_int32_t me_res1;
294 1.1 ad u_int8_t me_configured_channels;
295 1.1 ad u_int8_t me_actual_channels;
296 1.1 ad u_int8_t me_max_targets;
297 1.1 ad u_int8_t me_max_tags;
298 1.1 ad u_int8_t me_max_sys_drives;
299 1.1 ad u_int8_t me_max_arms;
300 1.1 ad u_int8_t me_max_spans;
301 1.1 ad u_int8_t me_res2;
302 1.1 ad u_int32_t me_res3;
303 1.1 ad u_int32_t me_mem_size;
304 1.1 ad u_int32_t me_cache_size;
305 1.1 ad u_int32_t me_flash_size;
306 1.1 ad u_int32_t me_nvram_size;
307 1.1 ad u_int16_t me_mem_type;
308 1.1 ad u_int16_t me_clock_speed;
309 1.1 ad u_int16_t me_mem_speed;
310 1.1 ad u_int16_t me_hardware_speed;
311 1.1 ad u_int8_t me_res4[12];
312 1.1 ad u_int16_t me_max_commands;
313 1.1 ad u_int16_t me_max_sg;
314 1.1 ad u_int16_t me_max_dp;
315 1.1 ad u_int16_t me_max_iod;
316 1.1 ad u_int16_t me_max_comb;
317 1.1 ad u_int8_t me_latency;
318 1.1 ad u_int8_t me_res5;
319 1.1 ad u_int8_t me_scsi_timeout;
320 1.1 ad u_int8_t me_res6;
321 1.1 ad u_int16_t me_min_freelines;
322 1.1 ad u_int8_t me_res7[8];
323 1.1 ad u_int8_t me_rate_const;
324 1.1 ad u_int8_t me_res8[11];
325 1.1 ad u_int16_t me_physblk;
326 1.1 ad u_int16_t me_logblk;
327 1.1 ad u_int16_t me_maxblk;
328 1.1 ad u_int16_t me_blocking_factor;
329 1.1 ad u_int16_t me_cacheline;
330 1.1 ad u_int8_t me_scsi_cap;
331 1.1 ad u_int8_t me_res9[5];
332 1.1 ad u_int16_t me_firmware_build;
333 1.1 ad u_int8_t me_fault_mgmt_type;
334 1.1 ad u_int8_t me_res10;
335 1.1 ad u_int32_t me_firmware_features;
336 1.1 ad u_int8_t me_res11[8];
337 1.1 ad } __attribute__ ((packed));
338 1.1 ad
339 1.1 ad /* MLX_CMD_ENQSYSDRIVE returns an array of 32 of these. */
340 1.1 ad struct mlx_enq_sys_drive {
341 1.1 ad u_int32_t sd_size;
342 1.1 ad u_int8_t sd_state;
343 1.1 ad u_int8_t sd_raidlevel;
344 1.1 ad u_int16_t sd_res1;
345 1.1 ad } __attribute__ ((packed));
346 1.1 ad
347 1.1 ad /*
348 1.1 ad * MLX_CMD_LOGOP/MLX_LOGOP_GET
349 1.1 ad *
350 1.1 ad * Bitfields:
351 1.1 ad *
352 1.1 ad * 0-4 el_target SCSI target
353 1.1 ad * 5-7 el_target SCSI channel
354 1.1 ad * 0-6 el_errorcode error code
355 1.1 ad * 7-7 el_errorcode validity (?)
356 1.1 ad * 0-3 el_sense sense key
357 1.1 ad * 4-4 el_sense reserved
358 1.1 ad * 5-5 el_sense ILI
359 1.1 ad * 6-6 el_sense EOM
360 1.1 ad * 7-7 el_sense filemark
361 1.1 ad */
362 1.1 ad struct mlx_eventlog_entry {
363 1.1 ad u_int8_t el_type;
364 1.1 ad u_int8_t el_length;
365 1.1 ad u_int8_t el_target;
366 1.1 ad u_int8_t el_lun;
367 1.1 ad u_int16_t el_seqno;
368 1.1 ad u_int8_t el_errorcode;
369 1.1 ad u_int8_t el_segment;
370 1.1 ad u_int8_t el_sense;
371 1.1 ad u_int8_t el_information[4];
372 1.1 ad u_int8_t el_addsense;
373 1.1 ad u_int8_t el_csi[4];
374 1.1 ad u_int8_t el_asc;
375 1.1 ad u_int8_t el_asq;
376 1.1 ad u_int8_t el_res3[12];
377 1.1 ad } __attribute__ ((packed));
378 1.1 ad
379 1.1 ad #define MLX_LOGOP_GET 0x00 /* operation codes for MLX_CMD_LOGOP */
380 1.1 ad #define MLX_LOGMSG_SENSE 0x00 /* log message contents codes */
381 1.1 ad
382 1.1 ad struct mlx_rebuild_stat {
383 1.1 ad u_int32_t rb_drive;
384 1.1 ad u_int32_t rb_size;
385 1.1 ad u_int32_t rb_remaining;
386 1.1 ad } __attribute__ ((packed));
387 1.1 ad
388 1.1 ad struct mlx_config {
389 1.1 ad u_int16_t cf_flags1;
390 1.1 ad #define MLX_CF2_ACTV_NEG 0x0002
391 1.1 ad #define MLX_CF2_NORSTRTRY 0x0080
392 1.1 ad #define MLX_CF2_STRGWRK 0x0100
393 1.1 ad #define MLX_CF2_HPSUPP 0x0200
394 1.1 ad #define MLX_CF2_NODISCN 0x0400
395 1.1 ad #define MLX_CF2_ARM 0x2000
396 1.1 ad #define MLX_CF2_OFM 0x8000
397 1.1 ad #define MLX_CF2_AEMI (MLX_CF2_ARM | MLX_CF2_OFM)
398 1.1 ad u_int8_t cf_oemid;
399 1.1 ad u_int8_t cf_oem_model;
400 1.1 ad u_int8_t cf_physical_sector;
401 1.1 ad u_int8_t cf_logical_sector;
402 1.1 ad u_int8_t cf_blockfactor;
403 1.1 ad u_int8_t cf_flags2;
404 1.1 ad #define MLX_CF2_READAH 0x01
405 1.1 ad #define MLX_CF2_BIOSDLY 0x02
406 1.1 ad #define MLX_CF2_REASS1S 0x10
407 1.1 ad #define MLX_CF2_FUAENABL 0x40
408 1.1 ad #define MLX_CF2_R5ALLS 0x80
409 1.1 ad u_int8_t cf_rcrate;
410 1.1 ad u_int8_t cf_res1;
411 1.1 ad u_int8_t cf_blocks_per_cache_line;
412 1.1 ad u_int8_t cf_blocks_per_stripe;
413 1.1 ad u_int8_t cf_scsi_param_0;
414 1.1 ad u_int8_t cf_scsi_param_1;
415 1.1 ad u_int8_t cf_scsi_param_2;
416 1.1 ad u_int8_t cf_scsi_param_3;
417 1.1 ad u_int8_t cf_scsi_param_4;
418 1.1 ad u_int8_t cf_scsi_param_5;
419 1.1 ad u_int8_t cf_scsi_initiator_id;
420 1.1 ad u_int8_t cf_res2;
421 1.1 ad u_int8_t cf_startup_mode;
422 1.1 ad u_int8_t cf_simultaneous_spinup_devices;
423 1.1 ad u_int8_t cf_delay_between_spinups;
424 1.1 ad u_int8_t cf_res3;
425 1.1 ad u_int16_t cf_checksum;
426 1.1 ad } __attribute__ ((packed));
427 1.1 ad
428 1.1 ad struct mlx_config2 {
429 1.1 ad struct mlx_config cf2_cf;
430 1.1 ad u_int8_t cf2_reserved0[26];
431 1.1 ad u_int8_t cf2_flags;
432 1.1 ad #define MLX_CF2_BIOS_DIS 0x01
433 1.1 ad #define MLX_CF2_CDROM_DIS 0x02
434 1.1 ad #define MLX_CF2_GEOM_255 0x20
435 1.1 ad u_int8_t cf2_reserved1[9];
436 1.1 ad u_int16_t cf2_checksum;
437 1.1 ad } __attribute__ ((__packed__));
438 1.1 ad
439 1.1 ad struct mlx_sys_drv_span {
440 1.1 ad u_int32_t sp_start_lba;
441 1.1 ad u_int32_t sp_nblks;
442 1.1 ad u_int8_t sp_arm[8];
443 1.1 ad } __attribute__ ((packed));
444 1.1 ad
445 1.1 ad struct mlx_sys_drv {
446 1.1 ad u_int8_t sd_status;
447 1.1 ad u_int8_t sd_ext_status;
448 1.1 ad u_int8_t sd_mod1;
449 1.1 ad u_int8_t sd_mod2;
450 1.1 ad u_int8_t sd_raidlevel;
451 1.1 ad #define MLX_SYS_DRV_WRITEBACK (1<<7)
452 1.1 ad #define MLX_SYS_DRV_RAID0 0
453 1.1 ad #define MLX_SYS_DRV_RAID1 1
454 1.1 ad #define MLX_SYS_DRV_RAID3 3
455 1.1 ad #define MLX_SYS_DRV_RAID5 5
456 1.1 ad #define MLX_SYS_DRV_RAID6 6
457 1.1 ad #define MLX_SYS_DRV_JBOD 7
458 1.1 ad u_int8_t sd_valid_arms;
459 1.1 ad u_int8_t sd_valid_spans;
460 1.1 ad u_int8_t sd_init_state;
461 1.1 ad #define MLX_SYS_DRV_INITTED 0x81;
462 1.1 ad struct mlx_sys_drv_span sd_span[4];
463 1.1 ad } __attribute__ ((packed));
464 1.1 ad
465 1.1 ad struct mlx_phys_drv {
466 1.1 ad u_int8_t pd_flags1;
467 1.1 ad #define MLX_PHYS_DRV_PRESENT 0x01
468 1.1 ad u_int8_t pd_flags2;
469 1.1 ad #define MLX_PHYS_DRV_OTHER 0x00
470 1.1 ad #define MLX_PHYS_DRV_DISK 0x01
471 1.1 ad #define MLX_PHYS_DRV_SEQUENTIAL 0x02
472 1.1 ad #define MLX_PHYS_DRV_CDROM 0x03
473 1.1 ad #define MLX_PHYS_DRV_FAST20 0x08
474 1.1 ad #define MLX_PHYS_DRV_SYNC 0x10
475 1.1 ad #define MLX_PHYS_DRV_FAST 0x20
476 1.1 ad #define MLX_PHYS_DRV_WIDE 0x40
477 1.1 ad #define MLX_PHYS_DRV_TAG 0x80
478 1.1 ad u_int8_t pd_status;
479 1.1 ad #define MLX_PHYS_DRV_DEAD 0x00
480 1.1 ad #define MLX_PHYS_DRV_WRONLY 0x02
481 1.1 ad #define MLX_PHYS_DRV_ONLINE 0x03
482 1.1 ad #define MLX_PHYS_DRV_STANDBY 0x10
483 1.1 ad u_int8_t pd_res1;
484 1.1 ad u_int8_t pd_period;
485 1.1 ad u_int8_t pd_offset;
486 1.1 ad u_int32_t pd_config_size;
487 1.1 ad } __attribute__ ((packed));
488 1.1 ad
489 1.1 ad struct mlx_core_cfg {
490 1.1 ad u_int8_t cc_num_sys_drives;
491 1.1 ad u_int8_t cc_res1[3];
492 1.1 ad struct mlx_sys_drv cc_sys_drives[32];
493 1.1 ad struct mlx_phys_drv cc_phys_drives[5 * 16];
494 1.1 ad } __attribute__ ((packed));
495 1.1 ad
496 1.1 ad /*
497 1.1 ad * Bitfields:
498 1.1 ad *
499 1.1 ad * 0-3 dcdb_target SCSI target
500 1.1 ad * 4-7 dcdb_target SCSI channel
501 1.1 ad * 0-3 dcdb_length CDB length
502 1.1 ad * 4-7 dcdb_length high 4 bits of `datasize'
503 1.1 ad */
504 1.1 ad struct mlx_dcdb {
505 1.1 ad u_int8_t dcdb_target;
506 1.1 ad u_int8_t dcdb_flags;
507 1.1 ad #define MLX_DCDB_NO_DATA 0x00
508 1.1 ad #define MLX_DCDB_DATA_IN 0x01
509 1.1 ad #define MLX_DCDB_DATA_OUT 0x02
510 1.1 ad #define MLX_DCDB_EARLY_STATUS 0x04
511 1.1 ad #define MLX_DCDB_TIMEOUT_10S 0x10 /* This lot is wrong? [ad] */
512 1.1 ad #define MLX_DCDB_TIMEOUT_60S 0x20
513 1.1 ad #define MLX_DCDB_TIMEOUT_20M 0x30
514 1.1 ad #define MLX_DCDB_TIMEOUT_24H 0x40
515 1.1 ad #define MLX_DCDB_NO_AUTO_SENSE 0x40 /* XXX ?? */
516 1.1 ad #define MLX_DCDB_DISCONNECT 0x80
517 1.1 ad u_int16_t dcdb_datasize;
518 1.1 ad u_int32_t dcdb_physaddr;
519 1.1 ad u_int8_t dcdb_length;
520 1.1 ad u_int8_t dcdb_sense_length;
521 1.1 ad u_int8_t dcdb_cdb[12];
522 1.1 ad u_int8_t dcdb_sense[64];
523 1.1 ad u_int8_t dcdb_status;
524 1.1 ad u_int8_t res1;
525 1.1 ad } __attribute__ ((packed));
526 1.1 ad
527 1.1 ad struct mlx_bbtable_entry {
528 1.1 ad u_int32_t bbt_block_number;
529 1.1 ad u_int8_t bbt_extent;
530 1.1 ad u_int8_t bbt_res1;
531 1.1 ad u_int8_t bbt_entry_type;
532 1.1 ad u_int8_t bbt_system_drive; /* high 3 bits reserved */
533 1.1 ad } __attribute__ ((packed));
534 1.1 ad
535 1.1 ad #endif /* !_IC_MLXREG_H_ */
536