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