mlxreg.h revision 1.1 1 1.1 ad /* $NetBSD: mlxreg.h,v 1.1 2001/02/04 17:05:12 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.1 ad #define MLX_STATUS_BUSY 0xdeed /* 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.1 ad
124 1.1 ad #define MLX_V1_ODB_SAVAIL 0x01 /* status is available */
125 1.1 ad
126 1.1 ad #define MLX_V1_FWERROR_PEND 0x04 /* firmware error pending */
127 1.1 ad
128 1.1 ad #define MLX_V1_MAILBOX_LEN 13
129 1.1 ad
130 1.1 ad /*
131 1.1 ad * V2/V3 interface.
132 1.1 ad */
133 1.1 ad #define MLX_V3REG_MAILBOX 0x00
134 1.1 ad #define MLX_V3REG_STATUS_IDENT 0x0d
135 1.1 ad #define MLX_V3REG_STATUS 0x0e
136 1.1 ad #define MLX_V3REG_IDB 0x40
137 1.1 ad #define MLX_V3REG_ODB 0x41
138 1.1 ad #define MLX_V3REG_IE 0x43
139 1.1 ad #define MLX_V3REG_FWERROR 0x3f
140 1.1 ad #define MLX_V3REG_FWERROR_PARAM1 0x00
141 1.1 ad #define MLX_V3REG_FWERROR_PARAM2 0x01
142 1.1 ad
143 1.1 ad #define MLX_V3_IDB_FULL 0x01 /* mailbox is full */
144 1.1 ad #define MLX_V3_IDB_INIT_BUSY 0x02 /* init in progress */
145 1.1 ad
146 1.1 ad #define MLX_V3_IDB_SACK 0x02 /* acknowledge status read */
147 1.1 ad
148 1.1 ad #define MLX_V3_ODB_SAVAIL 0x01 /* status is available */
149 1.1 ad
150 1.1 ad #define MLX_V3_FWERROR_PEND 0x04 /* firmware error pending */
151 1.1 ad
152 1.1 ad #define MLX_V3_MAILBOX_LEN 13
153 1.1 ad
154 1.1 ad /*
155 1.1 ad * V4 interface.
156 1.1 ad */
157 1.1 ad #define MLX_V4REG_MAILBOX 0x1000
158 1.1 ad #define MLX_V4REG_STATUS_IDENT 0x1018
159 1.1 ad #define MLX_V4REG_STATUS 0x101a
160 1.1 ad #define MLX_V4REG_IDB 0x0020
161 1.1 ad #define MLX_V4REG_ODB 0x002c
162 1.1 ad #define MLX_V4REG_IE 0x0034
163 1.1 ad #define MLX_V4REG_FWERROR 0x103f
164 1.1 ad #define MLX_V4REG_FWERROR_PARAM1 0x1000
165 1.1 ad #define MLX_V4REG_FWERROR_PARAM2 0x1001
166 1.1 ad
167 1.1 ad #define MLX_V4_IDB_FULL 0x01 /* mailbox is full */
168 1.1 ad #define MLX_V4_IDB_INIT_BUSY 0x02 /* initialisation in progress */
169 1.1 ad
170 1.1 ad #define MLX_V4_IDB_HWMBOX_CMD 0x01 /* posted hardware mailbox command */
171 1.1 ad #define MLX_V4_IDB_SACK 0x02 /* acknowledge status read */
172 1.1 ad #define MLX_V4_IDB_MEMMBOX_CMD 0x10 /* posted memory mailbox command */
173 1.1 ad
174 1.1 ad #define MLX_V4_ODB_HWSAVAIL 0x01 /* status available for hardware m/b */
175 1.1 ad #define MLX_V4_ODB_MEMSAVAIL 0x02 /* status available for memory m/b */
176 1.1 ad
177 1.1 ad #define MLX_V4_ODB_HWMBOX_ACK 0x01 /* ack status read from hardware m/b */
178 1.1 ad #define MLX_V4_ODB_MEMMBOX_ACK 0x02 /* ack status read from memory m/b */
179 1.1 ad
180 1.1 ad #define MLX_V4_IE_MASK 0xfb /* message unit interrupt mask */
181 1.1 ad #define MLX_V4_IE_DISINT 0x04 /* interrupt disable bit */
182 1.1 ad
183 1.1 ad #define MLX_V4_FWERROR_PEND 0x04 /* firmware error pending */
184 1.1 ad
185 1.1 ad #define MLX_V4_MAILBOX_LEN 16
186 1.1 ad
187 1.1 ad /*
188 1.1 ad * V5 interface.
189 1.1 ad */
190 1.1 ad #define MLX_V5REG_MAILBOX 0x50
191 1.1 ad #define MLX_V5REG_STATUS_IDENT 0x5d
192 1.1 ad #define MLX_V5REG_STATUS 0x5e
193 1.1 ad #define MLX_V5REG_IDB 0x60
194 1.1 ad #define MLX_V5REG_ODB 0x61
195 1.1 ad #define MLX_V5REG_IE 0x34
196 1.1 ad #define MLX_V5REG_FWERROR 0x63
197 1.1 ad #define MLX_V5REG_FWERROR_PARAM1 0x50
198 1.1 ad #define MLX_V5REG_FWERROR_PARAM2 0x51
199 1.1 ad
200 1.1 ad #define MLX_V5_IDB_EMPTY 0x01 /* mailbox is empty */
201 1.1 ad #define MLX_V5_IDB_INIT_DONE 0x02 /* initialisation has completed */
202 1.1 ad
203 1.1 ad #define MLX_V5_IDB_HWMBOX_CMD 0x01 /* posted hardware mailbox command */
204 1.1 ad #define MLX_V5_IDB_SACK 0x02 /* acknowledge status read */
205 1.1 ad #define MLX_V5_IDB_RESET 0x08 /* reset request */
206 1.1 ad #define MLX_V5_IDB_MEMMBOX_CMD 0x10 /* posted memory mailbox command */
207 1.1 ad
208 1.1 ad #define MLX_V5_ODB_HWSAVAIL 0x01 /* status available for hardware m/b */
209 1.1 ad #define MLX_V5_ODB_MEMSAVAIL 0x02 /* status available for memory m/b */
210 1.1 ad
211 1.1 ad #define MLX_V5_ODB_HWMBOX_ACK 0x01 /* ack status read from hardware m/b */
212 1.1 ad #define MLX_V5_ODB_MEMMBOX_ACK 0x02 /* ack status read from memory m/b */
213 1.1 ad
214 1.1 ad #define MLX_V5_IE_DISINT 0x04 /* interrupt disable bit */
215 1.1 ad
216 1.1 ad #define MLX_V5_FWERROR_PEND 0x04 /* firmware error pending */
217 1.1 ad
218 1.1 ad #define MLX_V5_MAILBOX_LEN 16
219 1.1 ad
220 1.1 ad #endif /* _KERNEL */
221 1.1 ad
222 1.1 ad /*
223 1.1 ad * Scatter-gather list format, type 1, kind 00.
224 1.1 ad */
225 1.1 ad struct mlx_sgentry {
226 1.1 ad u_int32_t sge_addr;
227 1.1 ad u_int32_t sge_count;
228 1.1 ad } __attribute__ ((packed));
229 1.1 ad
230 1.1 ad /*
231 1.1 ad * Command result buffers, as placed in system memory by the controller.
232 1.1 ad */
233 1.1 ad struct mlx_enquiry_old {
234 1.1 ad u_int8_t me_num_sys_drvs;
235 1.1 ad u_int8_t me_res1[3];
236 1.1 ad u_int32_t me_drvsize[8];
237 1.1 ad u_int16_t me_flash_age;
238 1.1 ad u_int8_t me_status_flags;
239 1.1 ad u_int8_t me_free_state_change_count;
240 1.1 ad u_int8_t me_fwminor;
241 1.1 ad u_int8_t me_fwmajor;
242 1.1 ad u_int8_t me_rebuild_flag;
243 1.1 ad u_int8_t me_max_commands;
244 1.1 ad u_int8_t me_offline_sd_count;
245 1.1 ad u_int8_t me_res3;
246 1.1 ad u_int8_t me_critical_sd_count;
247 1.1 ad u_int8_t me_res4[3];
248 1.1 ad u_int8_t me_dead_count;
249 1.1 ad u_int8_t me_res5;
250 1.1 ad u_int8_t me_rebuild_count;
251 1.1 ad u_int8_t me_misc_flags;
252 1.1 ad struct {
253 1.1 ad u_int8_t dd_targ;
254 1.1 ad u_int8_t dd_chan;
255 1.1 ad } __attribute__ ((packed)) me_dead[20];
256 1.1 ad } __attribute__ ((packed));
257 1.1 ad
258 1.1 ad struct mlx_enquiry {
259 1.1 ad u_int8_t me_num_sys_drvs;
260 1.1 ad u_int8_t me_res1[3];
261 1.1 ad u_int32_t me_drvsize[32];
262 1.1 ad u_int16_t me_flash_age;
263 1.1 ad u_int8_t me_status_flags;
264 1.1 ad #define MLX_ENQ_SFLAG_DEFWRERR 0x01 /* deferred write error indicator */
265 1.1 ad #define MLX_ENQ_SFLAG_BATTLOW 0x02 /* battery low */
266 1.1 ad u_int8_t me_res2;
267 1.1 ad u_int8_t me_fwminor;
268 1.1 ad u_int8_t me_fwmajor;
269 1.1 ad u_int8_t me_rebuild_flag;
270 1.1 ad u_int8_t me_max_commands;
271 1.1 ad u_int8_t me_offline_sd_count;
272 1.1 ad u_int8_t me_res3;
273 1.1 ad u_int16_t me_event_log_seq_num;
274 1.1 ad u_int8_t me_critical_sd_count;
275 1.1 ad u_int8_t me_res4[3];
276 1.1 ad u_int8_t me_dead_count;
277 1.1 ad u_int8_t me_res5;
278 1.1 ad u_int8_t me_rebuild_count;
279 1.1 ad u_int8_t me_misc_flags;
280 1.1 ad #define MLX_ENQ_MISC_BBU 0x08 /* battery backup present */
281 1.1 ad struct {
282 1.1 ad u_int8_t dd_targ;
283 1.1 ad u_int8_t dd_chan;
284 1.1 ad } __attribute__ ((packed)) me_dead[20];
285 1.1 ad } __attribute__ ((packed));
286 1.1 ad
287 1.1 ad struct mlx_enquiry2 {
288 1.1 ad u_int8_t me_hardware_id[4];
289 1.1 ad u_int8_t me_firmware_id[4];
290 1.1 ad u_int32_t me_res1;
291 1.1 ad u_int8_t me_configured_channels;
292 1.1 ad u_int8_t me_actual_channels;
293 1.1 ad u_int8_t me_max_targets;
294 1.1 ad u_int8_t me_max_tags;
295 1.1 ad u_int8_t me_max_sys_drives;
296 1.1 ad u_int8_t me_max_arms;
297 1.1 ad u_int8_t me_max_spans;
298 1.1 ad u_int8_t me_res2;
299 1.1 ad u_int32_t me_res3;
300 1.1 ad u_int32_t me_mem_size;
301 1.1 ad u_int32_t me_cache_size;
302 1.1 ad u_int32_t me_flash_size;
303 1.1 ad u_int32_t me_nvram_size;
304 1.1 ad u_int16_t me_mem_type;
305 1.1 ad u_int16_t me_clock_speed;
306 1.1 ad u_int16_t me_mem_speed;
307 1.1 ad u_int16_t me_hardware_speed;
308 1.1 ad u_int8_t me_res4[12];
309 1.1 ad u_int16_t me_max_commands;
310 1.1 ad u_int16_t me_max_sg;
311 1.1 ad u_int16_t me_max_dp;
312 1.1 ad u_int16_t me_max_iod;
313 1.1 ad u_int16_t me_max_comb;
314 1.1 ad u_int8_t me_latency;
315 1.1 ad u_int8_t me_res5;
316 1.1 ad u_int8_t me_scsi_timeout;
317 1.1 ad u_int8_t me_res6;
318 1.1 ad u_int16_t me_min_freelines;
319 1.1 ad u_int8_t me_res7[8];
320 1.1 ad u_int8_t me_rate_const;
321 1.1 ad u_int8_t me_res8[11];
322 1.1 ad u_int16_t me_physblk;
323 1.1 ad u_int16_t me_logblk;
324 1.1 ad u_int16_t me_maxblk;
325 1.1 ad u_int16_t me_blocking_factor;
326 1.1 ad u_int16_t me_cacheline;
327 1.1 ad u_int8_t me_scsi_cap;
328 1.1 ad u_int8_t me_res9[5];
329 1.1 ad u_int16_t me_firmware_build;
330 1.1 ad u_int8_t me_fault_mgmt_type;
331 1.1 ad u_int8_t me_res10;
332 1.1 ad u_int32_t me_firmware_features;
333 1.1 ad u_int8_t me_res11[8];
334 1.1 ad } __attribute__ ((packed));
335 1.1 ad
336 1.1 ad /* MLX_CMD_ENQSYSDRIVE returns an array of 32 of these. */
337 1.1 ad struct mlx_enq_sys_drive {
338 1.1 ad u_int32_t sd_size;
339 1.1 ad u_int8_t sd_state;
340 1.1 ad u_int8_t sd_raidlevel;
341 1.1 ad u_int16_t sd_res1;
342 1.1 ad } __attribute__ ((packed));
343 1.1 ad
344 1.1 ad /*
345 1.1 ad * MLX_CMD_LOGOP/MLX_LOGOP_GET
346 1.1 ad *
347 1.1 ad * Bitfields:
348 1.1 ad *
349 1.1 ad * 0-4 el_target SCSI target
350 1.1 ad * 5-7 el_target SCSI channel
351 1.1 ad * 0-6 el_errorcode error code
352 1.1 ad * 7-7 el_errorcode validity (?)
353 1.1 ad * 0-3 el_sense sense key
354 1.1 ad * 4-4 el_sense reserved
355 1.1 ad * 5-5 el_sense ILI
356 1.1 ad * 6-6 el_sense EOM
357 1.1 ad * 7-7 el_sense filemark
358 1.1 ad */
359 1.1 ad struct mlx_eventlog_entry {
360 1.1 ad u_int8_t el_type;
361 1.1 ad u_int8_t el_length;
362 1.1 ad u_int8_t el_target;
363 1.1 ad u_int8_t el_lun;
364 1.1 ad u_int16_t el_seqno;
365 1.1 ad u_int8_t el_errorcode;
366 1.1 ad u_int8_t el_segment;
367 1.1 ad u_int8_t el_sense;
368 1.1 ad u_int8_t el_information[4];
369 1.1 ad u_int8_t el_addsense;
370 1.1 ad u_int8_t el_csi[4];
371 1.1 ad u_int8_t el_asc;
372 1.1 ad u_int8_t el_asq;
373 1.1 ad u_int8_t el_res3[12];
374 1.1 ad } __attribute__ ((packed));
375 1.1 ad
376 1.1 ad #define MLX_LOGOP_GET 0x00 /* operation codes for MLX_CMD_LOGOP */
377 1.1 ad #define MLX_LOGMSG_SENSE 0x00 /* log message contents codes */
378 1.1 ad
379 1.1 ad struct mlx_rebuild_stat {
380 1.1 ad u_int32_t rb_drive;
381 1.1 ad u_int32_t rb_size;
382 1.1 ad u_int32_t rb_remaining;
383 1.1 ad } __attribute__ ((packed));
384 1.1 ad
385 1.1 ad struct mlx_config {
386 1.1 ad u_int16_t cf_flags1;
387 1.1 ad #define MLX_CF2_ACTV_NEG 0x0002
388 1.1 ad #define MLX_CF2_NORSTRTRY 0x0080
389 1.1 ad #define MLX_CF2_STRGWRK 0x0100
390 1.1 ad #define MLX_CF2_HPSUPP 0x0200
391 1.1 ad #define MLX_CF2_NODISCN 0x0400
392 1.1 ad #define MLX_CF2_ARM 0x2000
393 1.1 ad #define MLX_CF2_OFM 0x8000
394 1.1 ad #define MLX_CF2_AEMI (MLX_CF2_ARM | MLX_CF2_OFM)
395 1.1 ad u_int8_t cf_oemid;
396 1.1 ad u_int8_t cf_oem_model;
397 1.1 ad u_int8_t cf_physical_sector;
398 1.1 ad u_int8_t cf_logical_sector;
399 1.1 ad u_int8_t cf_blockfactor;
400 1.1 ad u_int8_t cf_flags2;
401 1.1 ad #define MLX_CF2_READAH 0x01
402 1.1 ad #define MLX_CF2_BIOSDLY 0x02
403 1.1 ad #define MLX_CF2_REASS1S 0x10
404 1.1 ad #define MLX_CF2_FUAENABL 0x40
405 1.1 ad #define MLX_CF2_R5ALLS 0x80
406 1.1 ad u_int8_t cf_rcrate;
407 1.1 ad u_int8_t cf_res1;
408 1.1 ad u_int8_t cf_blocks_per_cache_line;
409 1.1 ad u_int8_t cf_blocks_per_stripe;
410 1.1 ad u_int8_t cf_scsi_param_0;
411 1.1 ad u_int8_t cf_scsi_param_1;
412 1.1 ad u_int8_t cf_scsi_param_2;
413 1.1 ad u_int8_t cf_scsi_param_3;
414 1.1 ad u_int8_t cf_scsi_param_4;
415 1.1 ad u_int8_t cf_scsi_param_5;
416 1.1 ad u_int8_t cf_scsi_initiator_id;
417 1.1 ad u_int8_t cf_res2;
418 1.1 ad u_int8_t cf_startup_mode;
419 1.1 ad u_int8_t cf_simultaneous_spinup_devices;
420 1.1 ad u_int8_t cf_delay_between_spinups;
421 1.1 ad u_int8_t cf_res3;
422 1.1 ad u_int16_t cf_checksum;
423 1.1 ad } __attribute__ ((packed));
424 1.1 ad
425 1.1 ad struct mlx_config2 {
426 1.1 ad struct mlx_config cf2_cf;
427 1.1 ad u_int8_t cf2_reserved0[26];
428 1.1 ad u_int8_t cf2_flags;
429 1.1 ad #define MLX_CF2_BIOS_DIS 0x01
430 1.1 ad #define MLX_CF2_CDROM_DIS 0x02
431 1.1 ad #define MLX_CF2_GEOM_255 0x20
432 1.1 ad u_int8_t cf2_reserved1[9];
433 1.1 ad u_int16_t cf2_checksum;
434 1.1 ad } __attribute__ ((__packed__));
435 1.1 ad
436 1.1 ad struct mlx_sys_drv_span {
437 1.1 ad u_int32_t sp_start_lba;
438 1.1 ad u_int32_t sp_nblks;
439 1.1 ad u_int8_t sp_arm[8];
440 1.1 ad } __attribute__ ((packed));
441 1.1 ad
442 1.1 ad struct mlx_sys_drv {
443 1.1 ad u_int8_t sd_status;
444 1.1 ad u_int8_t sd_ext_status;
445 1.1 ad u_int8_t sd_mod1;
446 1.1 ad u_int8_t sd_mod2;
447 1.1 ad u_int8_t sd_raidlevel;
448 1.1 ad #define MLX_SYS_DRV_WRITEBACK (1<<7)
449 1.1 ad #define MLX_SYS_DRV_RAID0 0
450 1.1 ad #define MLX_SYS_DRV_RAID1 1
451 1.1 ad #define MLX_SYS_DRV_RAID3 3
452 1.1 ad #define MLX_SYS_DRV_RAID5 5
453 1.1 ad #define MLX_SYS_DRV_RAID6 6
454 1.1 ad #define MLX_SYS_DRV_JBOD 7
455 1.1 ad u_int8_t sd_valid_arms;
456 1.1 ad u_int8_t sd_valid_spans;
457 1.1 ad u_int8_t sd_init_state;
458 1.1 ad #define MLX_SYS_DRV_INITTED 0x81;
459 1.1 ad struct mlx_sys_drv_span sd_span[4];
460 1.1 ad } __attribute__ ((packed));
461 1.1 ad
462 1.1 ad struct mlx_phys_drv {
463 1.1 ad u_int8_t pd_flags1;
464 1.1 ad #define MLX_PHYS_DRV_PRESENT 0x01
465 1.1 ad u_int8_t pd_flags2;
466 1.1 ad #define MLX_PHYS_DRV_OTHER 0x00
467 1.1 ad #define MLX_PHYS_DRV_DISK 0x01
468 1.1 ad #define MLX_PHYS_DRV_SEQUENTIAL 0x02
469 1.1 ad #define MLX_PHYS_DRV_CDROM 0x03
470 1.1 ad #define MLX_PHYS_DRV_FAST20 0x08
471 1.1 ad #define MLX_PHYS_DRV_SYNC 0x10
472 1.1 ad #define MLX_PHYS_DRV_FAST 0x20
473 1.1 ad #define MLX_PHYS_DRV_WIDE 0x40
474 1.1 ad #define MLX_PHYS_DRV_TAG 0x80
475 1.1 ad u_int8_t pd_status;
476 1.1 ad #define MLX_PHYS_DRV_DEAD 0x00
477 1.1 ad #define MLX_PHYS_DRV_WRONLY 0x02
478 1.1 ad #define MLX_PHYS_DRV_ONLINE 0x03
479 1.1 ad #define MLX_PHYS_DRV_STANDBY 0x10
480 1.1 ad u_int8_t pd_res1;
481 1.1 ad u_int8_t pd_period;
482 1.1 ad u_int8_t pd_offset;
483 1.1 ad u_int32_t pd_config_size;
484 1.1 ad } __attribute__ ((packed));
485 1.1 ad
486 1.1 ad struct mlx_core_cfg {
487 1.1 ad u_int8_t cc_num_sys_drives;
488 1.1 ad u_int8_t cc_res1[3];
489 1.1 ad struct mlx_sys_drv cc_sys_drives[32];
490 1.1 ad struct mlx_phys_drv cc_phys_drives[5 * 16];
491 1.1 ad } __attribute__ ((packed));
492 1.1 ad
493 1.1 ad /*
494 1.1 ad * Bitfields:
495 1.1 ad *
496 1.1 ad * 0-3 dcdb_target SCSI target
497 1.1 ad * 4-7 dcdb_target SCSI channel
498 1.1 ad * 0-3 dcdb_length CDB length
499 1.1 ad * 4-7 dcdb_length high 4 bits of `datasize'
500 1.1 ad */
501 1.1 ad struct mlx_dcdb {
502 1.1 ad u_int8_t dcdb_target;
503 1.1 ad u_int8_t dcdb_flags;
504 1.1 ad #define MLX_DCDB_NO_DATA 0x00
505 1.1 ad #define MLX_DCDB_DATA_IN 0x01
506 1.1 ad #define MLX_DCDB_DATA_OUT 0x02
507 1.1 ad #define MLX_DCDB_EARLY_STATUS 0x04
508 1.1 ad #define MLX_DCDB_TIMEOUT_10S 0x10 /* This lot is wrong? [ad] */
509 1.1 ad #define MLX_DCDB_TIMEOUT_60S 0x20
510 1.1 ad #define MLX_DCDB_TIMEOUT_20M 0x30
511 1.1 ad #define MLX_DCDB_TIMEOUT_24H 0x40
512 1.1 ad #define MLX_DCDB_NO_AUTO_SENSE 0x40 /* XXX ?? */
513 1.1 ad #define MLX_DCDB_DISCONNECT 0x80
514 1.1 ad u_int16_t dcdb_datasize;
515 1.1 ad u_int32_t dcdb_physaddr;
516 1.1 ad u_int8_t dcdb_length;
517 1.1 ad u_int8_t dcdb_sense_length;
518 1.1 ad u_int8_t dcdb_cdb[12];
519 1.1 ad u_int8_t dcdb_sense[64];
520 1.1 ad u_int8_t dcdb_status;
521 1.1 ad u_int8_t res1;
522 1.1 ad } __attribute__ ((packed));
523 1.1 ad
524 1.1 ad struct mlx_bbtable_entry {
525 1.1 ad u_int32_t bbt_block_number;
526 1.1 ad u_int8_t bbt_extent;
527 1.1 ad u_int8_t bbt_res1;
528 1.1 ad u_int8_t bbt_entry_type;
529 1.1 ad u_int8_t bbt_system_drive; /* high 3 bits reserved */
530 1.1 ad } __attribute__ ((packed));
531 1.1 ad
532 1.1 ad #endif /* !_IC_MLXREG_H_ */
533