Remove all occurences of double semicolons at the end of a line by
[dragonfly.git] / sys / dev / raid / pst / pst-iop.h
1 /*-
2  * Copyright (c) 2001,2002 Søren Schmidt <sos@FreeBSD.org>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer,
10  *    without modification, immediately at the beginning of the file.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. The name of the author may not be used to endorse or promote products
15  *    derived from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  * $FreeBSD: src/sys/dev/pst/pst-iop.h,v 1.2.2.1 2002/08/18 12:32:36 sos Exp $
29  * $DragonFly: src/sys/dev/raid/pst/pst-iop.h,v 1.3 2006/08/03 16:40:47 swildner Exp $
30  */
31
32 /* misc defines */
33 MALLOC_DECLARE(M_PSTIOP);
34 #define I2O_IOP_OUTBOUND_FRAME_COUNT    32
35 #define I2O_IOP_OUTBOUND_FRAME_SIZE     0x20
36
37 /* structure defs */
38 struct out_mfa_buf {
39     u_int32_t   buf[I2O_IOP_OUTBOUND_FRAME_SIZE];
40 };
41
42 struct iop_softc {
43     struct resource             *r_mem;
44     struct resource             *r_irq;
45     caddr_t                     ibase;
46     u_int32_t                   phys_ibase;
47     caddr_t                     obase;
48     u_int32_t                   phys_obase;
49     struct i2o_registers        *reg;
50     struct i2o_status_get_reply *status;
51     int                         lct_count;
52     struct i2o_lct_entry        *lct;
53     device_t                    dev;
54     void                        *handle;
55     struct intr_config_hook     *iop_delayed_attach;
56 };
57
58 /* structure at start of IOP shared mem */
59 struct i2o_registers {
60     volatile u_int32_t  apic_select;
61     volatile u_int32_t  reserved0;
62     volatile u_int32_t  apic_winreg;
63     volatile u_int32_t  reserved1;
64     volatile u_int32_t  iqueue_reg0; 
65     volatile u_int32_t  iqueue_reg1;
66     volatile u_int32_t  oqueue_reg0;
67     volatile u_int32_t  oqueue_reg1;
68     volatile u_int32_t  iqueue_event;
69     volatile u_int32_t  iqueue_intr_status;
70     volatile u_int32_t  iqueue_intr_mask;
71     volatile u_int32_t  oqueue_event;
72     volatile u_int32_t  oqueue_intr_status;
73     volatile u_int32_t  oqueue_intr_mask;
74 #define I2O_OUT_INTR_QUEUE                              0x08
75 #define I2O_OUT_INTR_BELL                               0x04
76 #define I2O_OUT_INTR_MSG1                               0x02
77 #define I2O_OUT_INTR_MSG0                               0x01
78
79     volatile u_int64_t  reserved2;
80     volatile u_int32_t  iqueue;
81     volatile u_int32_t  oqueue;
82     volatile u_int64_t  reserved3;
83     volatile u_int64_t  mac_addr;
84     volatile u_int32_t  ip_addr;
85     volatile u_int32_t  ip_mask;
86 };
87
88 /* Scatter/Gather List management  */
89 struct i2o_sgl {
90     u_int32_t           count:24;
91 #define I2O_SGL_CNT_MASK                                0xffffff
92
93     u_int32_t           flags:8;
94 #define I2O_SGL_SIMPLE                                  0x10
95 #define I2O_SGL_PAGELIST                                0x20
96 #define I2O_SGL_CHAIN                                   0x30
97 #define I2O_SGL_ATTRIBUTE                               0x7c
98 #define I2O_SGL_BC0                                     0x01
99 #define I2O_SGL_BC1                                     0x02
100 #define I2O_SGL_DIR                                     0x04
101 #define I2O_SGL_LA                                      0x08
102 #define I2O_SGL_EOB                                     0x40
103 #define I2O_SGL_END                                     0x80
104
105     u_int32_t           phys_addr[1];
106 } __attribute__((packed));
107
108 #define I2O_SGL_MAX_SEGS        ((I2O_IOP_OUTBOUND_FRAME_SIZE - (8 + 2)) + 1)
109
110 /* i2o command codes */
111 #define I2O_UTIL_NOP                                    0x00
112 #define I2O_UTIL_PARAMS_GET                             0x06
113 #define I2O_UTIL_CLAIM                                  0x09
114 #define I2O_UTIL_CONFIG_DIALOG                          0x10
115 #define I2O_UTIL_EVENT_REGISTER                         0x13
116 #define I2O_BSA_BLOCK_READ                              0x30
117 #define I2O_BSA_BLOCK_WRITE                             0x31
118 #define I2O_BSA_CACHE_FLUSH                             0x37
119 #define I2O_EXEC_STATUS_GET                             0xa0
120 #define I2O_EXEC_OUTBOUND_INIT                          0xa1
121 #define I2O_EXEC_LCT_NOTIFY                             0xa2
122 #define I2O_EXEC_SYSTAB_SET                             0xa3
123 #define I2O_EXEC_IOP_RESET                              0xbd
124 #define I2O_EXEC_SYS_ENABLE                             0xd1
125
126 /* basic message layout */
127 struct i2o_basic_message {
128     u_int8_t            version:4;
129     u_int8_t            offset:4;
130     u_int8_t            message_flags;
131     u_int16_t           message_size;
132     u_int32_t           target_address:12;
133     u_int32_t           initiator_address:12;
134     u_int32_t           function:8;
135     u_int32_t           initiator_context;
136     u_int32_t           transaction_context;
137 } __attribute__((packed));
138
139 /* basic reply layout */
140 struct i2o_single_reply {
141     u_int8_t            version_offset;
142     u_int8_t            message_flags;
143 #define I2O_MESSAGE_FLAGS_STATIC                        0x01
144 #define I2O_MESSAGE_FLAGS_64BIT                         0x02
145 #define I2O_MESSAGE_FLAGS_MULTIPLE                      0x10
146 #define I2O_MESSAGE_FLAGS_FAIL                          0x20
147 #define I2O_MESSAGE_FLAGS_LAST                          0x40
148 #define I2O_MESSAGE_FLAGS_REPLY                         0x80
149
150     u_int16_t           message_size;
151     u_int32_t           target_address:12;
152     u_int32_t           initiator_address:12;
153     u_int32_t           function:8;
154     u_int32_t           initiator_context;
155     u_int32_t           transaction_context;
156     u_int16_t           detailed_status;
157 #define I2O_DETAIL_STATUS_SUCCESS                       0x0000
158 #define I2O_DETAIL_STATUS_BAD_KEY                       0x0002
159 #define I2O_DETAIL_STATUS_TCL_ERROR                     0x0003
160 #define I2O_DETAIL_STATUS_REPLY_BUFFER_FULL             0x0004
161 #define I2O_DETAIL_STATUS_NO_SUCH_PAGE                  0x0005
162 #define I2O_DETAIL_STATUS_INSUFFICIENT_RESOURCE_SOFT    0x0006
163 #define I2O_DETAIL_STATUS_INSUFFICIENT_RESOURCE_HARD    0x0007
164 #define I2O_DETAIL_STATUS_CHAIN_BUFFER_TOO_LARGE        0x0009
165 #define I2O_DETAIL_STATUS_UNSUPPORTED_FUNCTION          0x000a
166 #define I2O_DETAIL_STATUS_DEVICE_LOCKED                 0x000b
167 #define I2O_DETAIL_STATUS_DEVICE_RESET                  0x000c
168 #define I2O_DETAIL_STATUS_INAPPROPRIATE_FUNCTION        0x000d
169 #define I2O_DETAIL_STATUS_INVALID_INITIATOR_ADDRESS     0x000e
170 #define I2O_DETAIL_STATUS_INVALID_MESSAGE_FLAGS         0x000f
171 #define I2O_DETAIL_STATUS_INVALID_OFFSET                0x0010
172 #define I2O_DETAIL_STATUS_INVALID_PARAMETER             0x0011
173 #define I2O_DETAIL_STATUS_INVALID_REQUEST               0x0012
174 #define I2O_DETAIL_STATUS_INVALID_TARGET_ADDRESS        0x0013
175 #define I2O_DETAIL_STATUS_MESSAGE_TOO_LARGE             0x0014
176 #define I2O_DETAIL_STATUS_MESSAGE_TOO_SMALL             0x0015
177 #define I2O_DETAIL_STATUS_MISSING_PARAMETER             0x0016
178 #define I2O_DETAIL_STATUS_TIMEOUT                       0x0017
179 #define I2O_DETAIL_STATUS_UNKNOWN_ERROR                 0x0018
180 #define I2O_DETAIL_STATUS_UNKNOWN_FUNCTION              0x0019
181 #define I2O_DETAIL_STATUS_UNSUPPORTED_VERSION           0x001a
182 #define I2O_DETAIL_STATUS_DEVICE_BUSY                   0x001b
183 #define I2O_DETAIL_STATUS_DEVICE_NOT_AVAILABLE          0x001c
184
185     u_int8_t            retry_count;
186     u_int8_t            status;
187 #define I2O_REPLY_STATUS_SUCCESS                        0x00
188 #define I2O_REPLY_STATUS_ABORT_DIRTY                    0x01
189 #define I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER         0x02
190 #define I2O_REPLY_STATUS_ABORT_PARTIAL_TRANSFER         0x03
191 #define I2O_REPLY_STATUS_ERROR_DIRTY                    0x04
192 #define I2O_REPLY_STATUS_ERROR_NO_DATA_TRANSFER         0x05
193 #define I2O_REPLY_STATUS_ERROR_PARTIAL_TRANSFER         0x06
194 #define I2O_REPLY_STATUS_PROCESS_ABORT_DIRTY            0x08
195 #define I2O_REPLY_STATUS_PROCESS_ABORT_NO_DATA_TRANSFER 0x09
196 #define I2O_REPLY_STATUS_PROCESS_ABORT_PARTIAL_TRANSFER 0x0a
197 #define I2O_REPLY_STATUS_TRANSACTION_ERROR              0x0b
198 #define I2O_REPLY_STATUS_PROGRESS_REPORT                0x80
199
200     u_int32_t           donecount;
201 } __attribute__((packed));
202
203 struct i2o_fault_reply {
204     u_int8_t            version_offset;
205     u_int8_t            message_flags;
206     u_int16_t           message_size;
207     u_int32_t           target_address:12;
208     u_int32_t           initiator_address:12;
209     u_int32_t           function:8;
210     u_int32_t           initiator_context;
211     u_int32_t           transaction_context;
212     u_int8_t            lowest_version;
213     u_int8_t            highest_version;
214     u_int8_t            severity;
215 #define I2O_SEVERITY_FORMAT_ERROR                       0x01
216 #define I2O_SEVERITY_PATH_ERROR                         0x02
217 #define I2O_SEVERITY_PATH_STATE                         0x04
218 #define I2O_SEVERITY_CONGESTION                         0x08
219
220     u_int8_t            failure_code;
221 #define I2O_FAILURE_CODE_TRANSPORT_SERVICE_SUSPENDED    0x81
222 #define I2O_FAILURE_CODE_TRANSPORT_SERVICE_TERMINATED   0x82
223 #define I2O_FAILURE_CODE_TRANSPORT_CONGESTION           0x83
224 #define I2O_FAILURE_CODE_TRANSPORT_FAIL                 0x84
225 #define I2O_FAILURE_CODE_TRANSPORT_STATE_ERROR          0x85
226 #define I2O_FAILURE_CODE_TRANSPORT_TIME_OUT             0x86
227 #define I2O_FAILURE_CODE_TRANSPORT_ROUTING_FAILURE      0x87
228 #define I2O_FAILURE_CODE_TRANSPORT_INVALID_VERSION      0x88
229 #define I2O_FAILURE_CODE_TRANSPORT_INVALID_OFFSET       0x89
230 #define I2O_FAILURE_CODE_TRANSPORT_INVALID_MSG_FLAGS    0x8A
231 #define I2O_FAILURE_CODE_TRANSPORT_FRAME_TOO_SMALL      0x8B
232 #define I2O_FAILURE_CODE_TRANSPORT_FRAME_TOO_LARGE      0x8C
233 #define I2O_FAILURE_CODE_TRANSPORT_INVALID_TARGET_ID    0x8D
234 #define I2O_FAILURE_CODE_TRANSPORT_INVALID_INITIATOR_ID 0x8E
235 #define I2O_FAILURE_CODE_TRANSPORT_INVALID_INITIATOR_CONTEXT    0x8F
236 #define I2O_FAILURE_CODE_TRANSPORT_UNKNOWN_FAILURE      0xFF
237
238     u_int32_t           failing_iop_id:12;
239     u_int32_t           reserved:4;
240     u_int32_t           failing_host_unit_id:16;
241     u_int32_t           age_limit;
242     u_int64_t           preserved_mfa;
243 } __attribute__((packed));
244
245 struct i2o_exec_iop_reset_message {
246     u_int8_t            version_offset;
247     u_int8_t            message_flags;
248     u_int16_t           message_size;
249     u_int32_t           target_address:12;
250     u_int32_t           initiator_address:12;
251     u_int32_t           function:8;
252     u_int8_t            reserved[16];
253     u_int32_t           status_word_low_addr;
254     u_int32_t           status_word_high_addr;
255 } __attribute__((packed));
256
257 struct i2o_exec_status_get_message {
258     u_int8_t            version_offset;
259     u_int8_t            message_flags;
260     u_int16_t           message_size;
261     u_int32_t           target_address:12;
262     u_int32_t           initiator_address:12;
263     u_int32_t           function:8;
264     u_int8_t            reserved[16];
265     u_int32_t           reply_buf_low_addr;
266     u_int32_t           reply_buf_high_addr;
267     u_int32_t           reply_buf_length;
268 } __attribute__((packed));
269
270 struct i2o_status_get_reply {
271     u_int16_t           organization_id;
272     u_int16_t           reserved;
273     u_int32_t           iop_id:12;
274     u_int32_t           reserved1:4;
275     u_int32_t           host_unit_id:16;
276     u_int32_t           segment_number:12;
277     u_int32_t           i2o_version:4;
278     u_int32_t           iop_state:8;
279 #define I2O_IOP_STATE_INITIALIZING                      0x01
280 #define I2O_IOP_STATE_RESET                             0x02
281 #define I2O_IOP_STATE_HOLD                              0x04
282 #define I2O_IOP_STATE_READY                             0x05
283 #define I2O_IOP_STATE_OPERATIONAL                       0x08
284 #define I2O_IOP_STATE_FAILED                            0x10
285 #define I2O_IOP_STATE_FAULTED                           0x11
286
287     u_int32_t           messenger_type:8;
288     u_int16_t           inbound_mframe_size;
289     u_int8_t            init_code;
290     u_int8_t            reserved2;
291     u_int32_t           max_inbound_mframes;
292     u_int32_t           current_ibound_mframes;
293     u_int32_t           max_outbound_mframes;
294     u_int8_t            product_idstring[24];
295     u_int32_t           expected_lct_size;
296     u_int32_t           iop_capabilities;
297     u_int32_t           desired_private_memsize;
298     u_int32_t           current_private_memsize;
299     u_int32_t           current_private_membase;
300     u_int32_t           desired_private_iosize;
301     u_int32_t           current_private_iosize;
302     u_int32_t           current_private_iobase;
303     u_int8_t            reserved3[3];
304     u_int8_t            sync_byte;
305 } __attribute__((packed));
306
307 struct i2o_exec_init_outqueue_message {
308     u_int8_t            version_offset;
309     u_int8_t            message_flags;
310     u_int16_t           message_size;
311     u_int32_t           target_address:12;
312     u_int32_t           initiator_address:12;
313     u_int32_t           function:8;
314     u_int32_t           initiator_context;
315     u_int32_t           transaction_context;
316     u_int32_t           host_pagesize;
317     u_int8_t            init_code;
318     u_int8_t            reserved;
319     u_int16_t           queue_framesize;
320     struct i2o_sgl      sgl[2];
321 } __attribute__((packed));
322
323 #define I2O_EXEC_OUTBOUND_INIT_IN_PROGRESS              0x01
324 #define I2O_EXEC_OUTBOUND_INIT_REJECTED                 0x02
325 #define I2O_EXEC_OUTBOUND_INIT_FAILED                   0x03
326 #define I2O_EXEC_OUTBOUND_INIT_COMPLETE                 0x04
327
328 struct i2o_exec_systab_set_message {
329     u_int8_t            version_offset;
330     u_int8_t            message_flags;
331     u_int16_t           message_size;
332     u_int32_t           target_address:12;
333     u_int32_t           initiator_address:12;
334     u_int32_t           function:8;
335     u_int32_t           initiator_context;
336     u_int32_t           transaction_context;
337     u_int32_t           iop_id:12;
338 #define I2O_EXEC_SYS_TAB_IOP_ID_LOCAL_IOP               0x000     
339 #define I2O_EXEC_SYS_TAB_IOP_ID_LOCAL_HOST              0x001
340 #define I2O_EXEC_SYS_TAB_IOP_ID_UNKNOWN_IOP             0xfff  
341
342     u_int32_t           reserved1:4;
343     u_int32_t           host_unit_id:16;
344 #define I2O_EXEC_SYS_TAB_HOST_UNIT_ID_LOCAL_UNIT        0x0000 
345 #define I2O_EXEC_SYS_TAB_HOST_UNIT_ID_UNKNOWN_UNIT      0xffff
346
347     u_int32_t           segment_number:12;
348 #define I2O_EXEC_SYS_TAB_SEG_NUMBER_LOCAL_SEGMENT       0x000
349 #define I2O_EXEC_SYS_TAB_SEG_NUMBER_UNKNOWN_SEGMENT     0xfff
350
351     u_int32_t           reserved2:4;
352     u_int32_t           reserved3:8;
353     struct i2o_sgl      sgl[3];
354 } __attribute__((packed));
355
356 struct i2o_exec_systab {
357     u_int8_t            entries;
358     u_int8_t            version;
359 #define    I2O_RESOURCE_MANAGER_VERSION                 0
360
361     u_int16_t           reserved1;
362     u_int32_t           change_id;
363     u_int64_t           reserved2;
364     u_int16_t           organization_id;
365     u_int16_t           reserved3;
366     u_int32_t           iop_id:12;
367     u_int32_t           reserved4:20;
368     u_int32_t           segment_number:12;
369     u_int32_t           i2o_version:4;
370     u_int32_t           iop_state:8;
371     u_int32_t           messenger_type:8;
372     u_int16_t           inbound_mframe_size;
373     u_int16_t           reserved5;
374     u_int32_t           last_changed;
375     u_int32_t           iop_capabilities;
376     u_int64_t           messenger_info;
377 } __attribute__((packed));
378
379 struct i2o_exec_get_lct_message {
380     u_int8_t            version_offset;
381     u_int8_t            message_flags;
382     u_int16_t           message_size;
383     u_int32_t           target_address:12;
384     u_int32_t           initiator_address:12;
385     u_int32_t           function:8;
386     u_int32_t           initiator_context;
387     u_int32_t           transaction_context;
388     u_int32_t           class;
389     u_int32_t           last_change_id;
390     struct i2o_sgl      sgl;
391 } __attribute__((packed));
392
393 #define I2O_TID_IOP                                     0x000
394 #define I2O_TID_HOST                                    0x001
395 #define I2O_TID_NONE                                    0xfff
396
397 struct i2o_lct_entry {
398     u_int32_t           entry_size:16;
399     u_int32_t           local_tid:12;
400     u_int32_t           reserved:4;
401     u_int32_t           change_id;
402     u_int32_t           device_flags;
403     u_int32_t           class:12;
404 #define I2O_CLASS_EXECUTIVE                             0x000
405 #define I2O_CLASS_DDM                                   0x001
406 #define I2O_CLASS_RANDOM_BLOCK_STORAGE                  0x010
407 #define I2O_CLASS_SEQUENTIAL_STORAGE                    0x011
408 #define I2O_CLASS_LAN                                   0x020
409 #define I2O_CLASS_WAN                                   0x030
410 #define I2O_CLASS_FIBRE_CHANNEL_PORT                    0x040
411 #define I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL              0x041
412 #define I2O_CLASS_SCSI_PERIPHERAL                       0x051
413 #define I2O_CLASS_ATE_PORT                              0x060
414 #define I2O_CLASS_ATE_PERIPHERAL                        0x061
415 #define I2O_CLASS_FLOPPY_CONTROLLER                     0x070
416 #define I2O_CLASS_FLOPPY_DEVICE                         0x071
417 #define I2O_CLASS_BUS_ADAPTER_PORT                      0x080
418 #define I2O_CLASS_MATCH_ANYCLASS                        0xffffffff
419
420     u_int32_t           class_version:4;
421     u_int32_t           class_org:16;
422     u_int32_t           sub_class;
423 #define I2O_SUBCLASS_i960                               0x001
424 #define I2O_SUBCLASS_HDM                                0x020
425 #define I2O_SUBCLASS_ISM                                0x021
426
427     u_int32_t           user_tid:12;
428     u_int32_t           parent_tid:12;
429     u_int32_t           bios_info:8;
430     u_int8_t            identity_tag[8];
431     u_int32_t           event_capabilities;
432 } __attribute__((packed));
433
434 #define I2O_LCT_ENTRYSIZE (sizeof(struct i2o_lct_entry)/sizeof(u_int32_t))
435
436 struct i2o_get_lct_reply {
437     u_int32_t           table_size:16;
438     u_int32_t           boot_device:12;
439     u_int32_t           lct_version:4;
440     u_int32_t           iop_flags;
441     u_int32_t           current_change_id;
442     struct i2o_lct_entry entry[1];
443 } __attribute__((packed));
444
445 struct i2o_util_get_param_message {
446     u_int8_t            version_offset;
447     u_int8_t            message_flags;
448     u_int16_t           message_size;
449     u_int32_t           target_address:12;
450     u_int32_t           initiator_address:12;
451     u_int32_t           function:8;
452     u_int32_t           initiator_context;
453     u_int32_t           transaction_context;
454     u_int32_t           operation_flags;
455     struct i2o_sgl      sgl[2];
456 } __attribute__((packed));
457
458 struct i2o_get_param_template {
459     u_int16_t           operation;
460 #define I2O_PARAMS_OPERATION_FIELD_GET                  0x0001
461 #define I2O_PARAMS_OPERATION_LIST_GET                   0x0002
462 #define I2O_PARAMS_OPERATION_MORE_GET                   0x0003
463 #define I2O_PARAMS_OPERATION_SIZE_GET                   0x0004
464 #define I2O_PARAMS_OPERATION_TABLE_GET                  0x0005
465 #define I2O_PARAMS_OPERATION_FIELD_SET                  0x0006
466 #define I2O_PARAMS_OPERATION_LIST_SET                   0x0007
467 #define I2O_PARAMS_OPERATION_ROW_ADD                    0x0008
468 #define I2O_PARAMS_OPERATION_ROW_DELETE                 0x0009
469 #define I2O_PARAMS_OPERATION_TABLE_CLEAR                0x000A
470
471     u_int16_t           group;
472 #define I2O_BSA_DEVICE_INFO_GROUP_NO                    0x0000
473 #define I2O_BSA_OPERATIONAL_CONTROL_GROUP_NO            0x0001
474 #define I2O_BSA_POWER_CONTROL_GROUP_NO                  0x0002
475 #define I2O_BSA_CACHE_CONTROL_GROUP_NO                  0x0003
476 #define I2O_BSA_MEDIA_INFO_GROUP_NO                     0x0004
477 #define I2O_BSA_ERROR_LOG_GROUP_NO                      0x0005
478
479 #define I2O_UTIL_PARAMS_DESCRIPTOR_GROUP_NO             0xF000
480 #define I2O_UTIL_PHYSICAL_DEVICE_TABLE_GROUP_NO         0xF001
481 #define I2O_UTIL_CLAIMED_TABLE_GROUP_NO                 0xF002
482 #define I2O_UTIL_USER_TABLE_GROUP_NO                    0xF003
483 #define I2O_UTIL_PRIVATE_MESSAGE_EXTENSIONS_GROUP_NO    0xF005
484 #define I2O_UTIL_AUTHORIZED_USER_TABLE_GROUP_NO         0xF006
485 #define I2O_UTIL_DEVICE_IDENTITY_GROUP_NO               0xF100
486 #define I2O_UTIL_DDM_IDENTITY_GROUP_NO                  0xF101
487 #define I2O_UTIL_USER_INFORMATION_GROUP_NO              0xF102
488 #define I2O_UTIL_SGL_OPERATING_LIMITS_GROUP_NO          0xF103
489 #define I2O_UTIL_SENSORS_GROUP_NO                       0xF200
490
491     u_int16_t           field_count;
492     u_int16_t           pad;
493 } __attribute__((packed));
494
495 struct i2o_get_param_operation {
496     u_int16_t           operation_count;
497     u_int16_t           reserved;
498     struct i2o_get_param_template operation[1];
499 } __attribute__((packed));
500     
501 struct i2o_get_param_reply {
502     u_int16_t           result_count;
503     u_int16_t           reserved;
504     u_int16_t           block_size;
505     u_int8_t            block_status;
506     u_int8_t            error_info_size;
507     u_int32_t           result[1];
508 } __attribute__((packed));
509
510 struct i2o_device_identity {
511     u_int32_t           class;
512     u_int16_t           owner;
513     u_int16_t           parent;
514     u_int8_t            vendor[16];
515     u_int8_t            product[16];
516     u_int8_t            description[16];
517     u_int8_t            revision[8];
518     u_int8_t            sn_format;
519     u_int8_t            serial[256];
520 } __attribute__((packed));
521
522 struct i2o_bsa_device {
523     u_int8_t            device_type;
524     u_int8_t            path_count;
525     u_int16_t           power_state;
526     u_int32_t           block_size;
527     u_int64_t           capacity;
528     u_int32_t           capabilities;
529     u_int32_t           state;
530 } __attribute__((packed));
531
532 struct i2o_util_claim_message {
533     u_int8_t            version_offset;
534     u_int8_t            message_flags;
535     u_int16_t           message_size;
536     u_int32_t           target_address:12;
537     u_int32_t           initiator_address:12;
538     u_int32_t           function:8;
539     u_int32_t           initiator_context;
540     u_int32_t           transaction_context;
541     u_int16_t           claim_flags;
542     u_int8_t            reserved;
543     u_int8_t            claim_type;
544 } __attribute__((packed));
545
546 struct i2o_util_event_register_message {
547     u_int8_t            version_offset;
548     u_int8_t            message_flags;
549     u_int16_t           message_size;
550     u_int32_t           target_address:12;
551     u_int32_t           initiator_address:12;
552     u_int32_t           function:8;
553     u_int32_t           initiator_context;
554     u_int32_t           transaction_context;
555     u_int32_t           event_mask;
556 } __attribute__((packed));
557
558 struct i2o_util_event_reply_message {
559     u_int8_t            version_offset;
560     u_int8_t            message_flags;
561     u_int16_t           message_size;
562     u_int32_t           target_address:12;
563     u_int32_t           initiator_address:12;
564     u_int32_t           function:8;
565     u_int32_t           initiator_context;
566     u_int32_t           transaction_context;
567     u_int32_t           event_mask;
568     u_int32_t           event_data[1];
569 } __attribute__((packed));
570
571 struct i2o_util_config_dialog_message {
572     u_int8_t            version_offset;
573     u_int8_t            message_flags;
574     u_int16_t           message_size;
575     u_int32_t           target_address:12;
576     u_int32_t           initiator_address:12;
577     u_int32_t           function:8;
578     u_int32_t           initiator_context;
579     u_int32_t           transaction_context;
580     u_int32_t           page_number;
581     struct i2o_sgl      sgl[2];
582 } __attribute__((packed));
583
584 struct i2o_bsa_rw_block_message {
585     u_int8_t            version_offset;
586     u_int8_t            message_flags;
587     u_int16_t           message_size;
588     u_int32_t           target_address:12;
589     u_int32_t           initiator_address:12;
590     u_int32_t           function:8;
591     u_int32_t           initiator_context;
592     u_int32_t           transaction_context;
593     u_int16_t           control_flags;
594     u_int8_t            time_multiplier;
595     u_int8_t            fetch_ahead;
596     u_int32_t           bytecount;
597     u_int64_t           lba;
598     struct i2o_sgl      sgl;
599 } __attribute__((packed));
600
601 struct i2o_bsa_cache_flush_message {
602     u_int8_t            version_offset;
603     u_int8_t            message_flags;
604     u_int16_t           message_size;
605     u_int32_t           target_address:12;
606     u_int32_t           initiator_address:12;
607     u_int32_t           function:8;
608     u_int32_t           initiator_context;
609     u_int32_t           transaction_context;
610     u_int16_t           control_flags;
611     u_int8_t            time_multiplier;
612     u_int8_t            reserved;
613 } __attribute__((packed));
614
615 /* prototypes */
616 int iop_init(struct iop_softc *);
617 void iop_attach(struct iop_softc *);
618 void iop_intr(void *);
619 int iop_reset(struct iop_softc *);
620 int iop_init_outqueue(struct iop_softc *);
621 int iop_get_lct(struct iop_softc *);
622 struct i2o_get_param_reply *iop_get_util_params(struct iop_softc *,int,int,int);
623 u_int32_t iop_get_mfa(struct iop_softc *);
624 void iop_free_mfa(struct iop_softc *, int);
625 int iop_queue_wait_msg(struct iop_softc *, int, struct i2o_basic_message *);
626 int iop_create_sgl(struct i2o_basic_message *, caddr_t, int, int); 
627
628 /* global prototypes */
629 int pst_add_raid(struct iop_softc *, struct i2o_lct_entry *);