i2o.h revision 1.1.2.2 1 /* $NetBSD: i2o.h,v 1.1.2.2 2000/11/22 17:34:20 bouyer Exp $ */
2
3 /*-
4 * Copyright (c) 2000 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Andrew Doran.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 /*
40 * I2O structures and constants, as presented by the I2O specification
41 * revision 1.5 (obtainable from http://www.i2osig.org/). Currently, only
42 * what's useful to us is defined in this file.
43 */
44
45 #ifndef _I2O_I2O_H_
46 #define _I2O_I2O_H_
47
48 /*
49 * ================= Miscellenous definitions =================
50 */
51
52 /* Macros to assist in building message headers */
53 #define I2O_MSGFLAGS(s) (I2O_VERSION_11 | (sizeof(struct s) << 14))
54 #define I2O_MSGFUNC(t, f) ((t) | (I2O_TID_HOST << 12) | ((f) << 24))
55
56 /* Common message function codes with no payload or an undefined payload */
57 #define I2O_UTIL_NOP 0x00
58 #define I2O_EXEC_IOP_CLEAR 0xbe
59 #define I2O_EXEC_SYS_QUIESCE 0xc3
60 #define I2O_EXEC_SYS_ENABLE 0xd1
61 #define I2O_PRIVATE_MESSAGE 0xff
62
63 /* Device class codes */
64 #define I2O_CLASS_EXECUTIVE 0x00
65 #define I2O_CLASS_DDM 0x01
66 #define I2O_CLASS_RANDOM_BLOCK_STORAGE 0x10
67 #define I2O_CLASS_SEQUENTIAL_STORAGE 0x11
68 #define I2O_CLASS_LAN 0x20
69 #define I2O_CLASS_WAN 0x30
70 #define I2O_CLASS_FIBRE_CHANNEL_PORT 0x40
71 #define I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL 0x41
72 #define I2O_CLASS_SCSI_PERIPHERAL 0x51
73 #define I2O_CLASS_ATE_PORT 0x60
74 #define I2O_CLASS_ATE_PERIPHERAL 0x61
75 #define I2O_CLASS_FLOPPY_CONTROLLER 0x70
76 #define I2O_CLASS_FLOPPY_DEVICE 0x71
77 #define I2O_CLASS_BUS_ADAPTER_PORT 0x80
78
79 #define I2O_CLASS_ANY 0xffffffff
80
81 /* Reply status codes */
82 #define I2O_STATUS_SUCCESS 0x00
83 #define I2O_STATUS_ABORT_DIRTY 0x01
84 #define I2O_STATUS_ABORT_NO_DATA_XFER 0x02
85 #define I2O_STATUS_ABORT_PARTIAL_XFER 0x03
86 #define I2O_STATUS_ERROR_DIRTY 0x04
87 #define I2O_STATUS_ERROR_NO_DATA_XFER 0x05
88 #define I2O_STATUS_ERROR_PARTIAL_XFER 0x06
89 #define I2O_STATUS_PROCESS_ABORT_DIRTY 0x08
90 #define I2O_STATUS_PROCESS_ABORT_NO_DATA_XFER 0x09
91 #define I2O_STATUS_PROCESS_ABORT_PARTIAL_XFER 0x0a
92 #define I2O_STATUS_TRANSACTION_ERROR 0x0b
93 #define I2O_STATUS_PROGRESS_REPORT 0x80
94
95 /* Message versions */
96 #define I2O_VERSION_10 0x00
97 #define I2O_VERSION_11 0x01
98 #define I2O_VERSION_20 0x02
99
100 /* Commonly used TIDs */
101 #define I2O_TID_IOP 0
102 #define I2O_TID_HOST 1
103 #define I2O_TID_NONE 4095
104
105 /* SGL flags. This list covers only a fraction of the possibilities. */
106 #define I2O_SGL_DATA_OUT 0x04000000
107 #define I2O_SGL_SIMPLE 0x10000000
108 #define I2O_SGL_END_BUFFER 0x40000000
109 #define I2O_SGL_END 0x80000000
110
111 /* Serial number formats */
112 #define I2O_SNFMT_UNKNOWN 0
113 #define I2O_SNFMT_BINARY 1
114 #define I2O_SNFMT_ASCII 2
115 #define I2O_SNFMT_UNICODE 3
116 #define I2O_SNFMT_LAN_MAC 4
117 #define I2O_SNFMT_WAN_MAC 5
118
119 /*
120 * ================= Common structures =================
121 */
122
123 /*
124 * Standard I2O message frame. All message frames begin with this.
125 *
126 * Bits Field Meaning
127 * ---- ------------- ----------------------------------------------------
128 * 0-2 msgflags Message header version. Must be 001 (little endian).
129 * 3 msgflags Reserved.
130 * 4-7 msgflags Offset to SGLs expressed as # of 32-bit words.
131 * 8-15 msgflags Control flags.
132 * 16-31 msgflags Message frame size expressed as # of 32-bit words.
133 * 0-11 msgfunc TID of target.
134 * 12-23 msgfunc TID of initiator.
135 * 24-31 msgfunc Function (i.e., type of message).
136 */
137 struct i2o_msg {
138 u_int32_t msgflags;
139 u_int32_t msgfunc;
140 u_int32_t msgictx; /* Initiator context */
141 u_int32_t msgtctx; /* Transaction context */
142
143 /* Message payload */
144
145 } __attribute__ ((__packed__));
146
147 #define I2O_MSGFLAGS_STATICMF 0x0100
148 #define I2O_MSGFLAGS_64BIT 0x0200
149 #define I2O_MSGFLAGS_MULTI 0x1000
150 #define I2O_MSGFLAGS_CANT_PROCESS 0x2000
151 #define I2O_MSGFLAGS_LAST_REPLY 0x4000
152 #define I2O_MSGFLAGS_REPLY 0x8000
153
154 /*
155 * Standard reply frame. msgflags, msgfunc, msgictx and msgtctx have the
156 * same meaning as in `struct i2o_msg'.
157 *
158 * Bits Field Meaning
159 * ---- ------------- ----------------------------------------------------
160 * 0-15 status Detailed status code. Specific to device class.
161 * 16-23 status Reserved.
162 * 24-31 status Request status code.
163 */
164 struct i2o_reply {
165 u_int32_t msgflags;
166 u_int32_t msgfunc;
167 u_int32_t msgictx;
168 u_int32_t msgtctx;
169 u_int16_t detail;
170 u_int8_t reserved;
171 u_int8_t reqstatus;
172
173 /* Reply payload */
174
175 } __attribute__ ((__packed__));
176
177 /*
178 * Hardware resource table. Not documented here.
179 */
180 struct i2o_hrt_entry {
181 u_int32_t adapterid;
182 u_int32_t controllingtid;
183 u_int8_t businfo[8];
184 } __attribute__ ((__packed__));
185
186 struct i2o_hrt {
187 u_int16_t nentries;
188 u_int8_t entrysize;
189 u_int8_t hrtversion;
190 u_int32_t changeindicator;
191 struct i2o_hrt_entry entry[1];
192 } __attribute__ ((__packed__));
193
194 /*
195 * Logical configuration table entry. Bitfields are broken down as follows:
196 *
197 * Bits Field Meaning
198 * ----- -------------- ---------------------------------------------------
199 * 0-11 classid Class ID.
200 * 12-15 classid Class version.
201 * 0-11 usertid User TID
202 * 12-23 usertid Parent TID.
203 * 24-31 usertid BIOS info.
204 */
205 struct i2o_lct_entry {
206 u_int16_t entrysize;
207 u_int16_t localtid; /* Bits 0-12 only */
208 u_int32_t changeindicator;
209 u_int32_t deviceflags;
210 u_int16_t classid;
211 u_int16_t orgid;
212 u_int32_t subclassinfo;
213 u_int32_t usertid;
214 u_int8_t identitytag[8];
215 u_int32_t eventcaps;
216 } __attribute__ ((__packed__));
217
218 /*
219 * Logical configuration table header.
220 */
221 struct i2o_lct {
222 u_int16_t tablesize;
223 u_int8_t boottid;
224 u_int8_t lctversion;
225 u_int32_t iopflags;
226 u_int32_t changeindicator;
227 struct i2o_lct_entry entry[1];
228 } __attribute__ ((__packed__));
229
230 /*
231 * IOP system table entry. Bitfields are broken down as follows:
232 *
233 * Bits Field Meaning
234 * ----- -------------- ---------------------------------------------------
235 * 0-11 iopid IOP ID.
236 * 12-31 iopid Reserved.
237 * 0-11 segnumber Segment number.
238 * 12-15 segnumber I2O version.
239 * 16-23 segnumber IOP state.
240 * 24-31 segnumber Messenger type.
241 */
242 struct i2o_iop_entry {
243 u_int16_t orgid;
244 u_int16_t reserved0;
245 u_int32_t iopid;
246 u_int32_t segnumber; /* Bitfields */
247 u_int16_t inboundmsgframesize;
248 u_int16_t reserved1;
249 u_int32_t lastchanged;
250 u_int32_t iopcaps;
251 u_int32_t inboundmsgportaddresslow;
252 u_int32_t inboundmsgportaddresshigh;
253 } __attribute__ ((__packed__));
254
255 /*
256 * IOP status record. Bitfields are broken down as follows:
257 *
258 * Bits Field Meaning
259 * ----- -------------- ---------------------------------------------------
260 * 0-11 iopid IOP ID.
261 * 12-15 iopid Reserved.
262 * 16-31 iopid Host unit ID.
263 * 0-11 segnumber Segment number.
264 * 12-15 segnumber I2O version.
265 * 16-23 segnumber IOP state.
266 * 24-31 segnumber Messenger type.
267 */
268 struct i2o_status {
269 u_int16_t orgid;
270 u_int16_t reserved0;
271 u_int32_t iopid; /* Bitfields */
272 u_int32_t segnumber; /* Bitfields */
273 u_int16_t inboundmframesize;
274 u_int8_t initcode;
275 u_int8_t reserved1;
276 u_int32_t maxinboundmframes;
277 u_int32_t currentinboundmframes;
278 u_int32_t maxoutboundmframes;
279 u_int8_t productid[24];
280 u_int32_t expectedlctsize;
281 u_int32_t iopcaps;
282 u_int32_t desiredprivmemsize;
283 u_int32_t currentprivmemsize;
284 u_int32_t currentprivmembase;
285 u_int32_t desiredpriviosize;
286 u_int32_t currentpriviosize;
287 u_int32_t currentpriviobase;
288 u_int8_t reserved2[3];
289 u_int8_t syncbyte;
290 } __attribute__ ((__packed__));
291
292 #define I2O_IOP_STATE_INITIALIZING 0x01
293 #define I2O_IOP_STATE_RESET 0x02
294 #define I2O_IOP_STATE_HOLD 0x04
295 #define I2O_IOP_STATE_READY 0x05
296 #define I2O_IOP_STATE_OPERATIONAL 0x08
297 #define I2O_IOP_STATE_FAILED 0x10
298 #define I2O_IOP_STATE_FAULTED 0x11
299
300 /*
301 * ================= Executive class messages =================
302 */
303
304 /*
305 * Retrieve adapter status.
306 */
307 #define I2O_EXEC_STATUS_GET 0xa0
308 struct i2o_exec_status_get {
309 u_int32_t msgflags;
310 u_int32_t msgfunc;
311 u_int32_t reserved[4];
312 u_int32_t addrlow;
313 u_int32_t addrhigh;
314 u_int32_t length;
315 } __attribute__ ((__packed__));
316
317 /*
318 * Initalize outbound FIFO.
319 */
320 #define I2O_EXEC_OUTBOUND_INIT 0xa1
321 struct i2o_exec_outbound_init {
322 u_int32_t msgflags;
323 u_int32_t msgfunc;
324 u_int32_t msgictx;
325 u_int32_t msgtctx;
326 u_int32_t pagesize;
327 u_int32_t flags; /* init code, outbound msg size */
328 } __attribute__ ((__packed__));
329
330 #define I2O_EXEC_OUTBOUND_INIT_IN_PROGRESS 1
331 #define I2O_EXEC_OUTBOUND_INIT_REJECTED 2
332 #define I2O_EXEC_OUTBOUND_INIT_FAILED 3
333 #define I2O_EXEC_OUTBOUND_INIT_COMPLETE 4
334
335 /*
336 * Notify host of LCT change.
337 */
338 #define I2O_EXEC_LCT_NOTIFY 0xa2
339 struct i2o_exec_lct_notify {
340 u_int32_t msgflags;
341 u_int32_t msgfunc;
342 u_int32_t msgictx;
343 u_int32_t msgtctx;
344 u_int32_t classid;
345 u_int32_t changeindicator;
346 } __attribute__ ((__packed__));
347
348 /*
349 * Set system table.
350 */
351 #define I2O_EXEC_SYS_TAB_SET 0xa3
352 struct i2o_exec_sys_tab_set {
353 u_int32_t msgflags;
354 u_int32_t msgfunc;
355 u_int32_t msgictx;
356 u_int32_t msgtctx;
357 u_int32_t iopid;
358 u_int32_t segnumber;
359 } __attribute__ ((__packed__));
360
361 /*
362 * Retrieve hardware resource table.
363 */
364 #define I2O_EXEC_HRT_GET 0xa8
365 struct i2o_exec_hrt_get {
366 u_int32_t msgflags;
367 u_int32_t msgfunc;
368 u_int32_t msgictx;
369 u_int32_t msgtctx;
370 } __attribute__ ((__packed__));
371
372 /*
373 * Reset IOP.
374 */
375 #define I2O_EXEC_IOP_RESET 0xbd
376 struct i2o_exec_iop_reset {
377 u_int32_t msgflags;
378 u_int32_t msgfunc;
379 u_int32_t reserved[4];
380 u_int32_t statuslow;
381 u_int32_t statushigh;
382 } __attribute__ ((__packed__));
383
384 #define I2O_RESET_IN_PROGRESS 0x01
385 #define I2O_RESET_REJECTED 0x02
386
387 /*
388 * ================= HBA class messages =================
389 */
390
391 #define I2O_HBA_BUS_SCAN 0x89
392 struct i2o_hba_bus_scan {
393 u_int32_t msgflags;
394 u_int32_t msgfunc;
395 u_int32_t msgictx;
396 u_int32_t msgtctx;
397 };
398
399 /*
400 * ================= HBA class parameter groups =================
401 */
402
403 #define I2O_PARAM_HBA_CTLR_INFO 0x0000
404 struct i2o_param_hba_ctlr_info {
405 u_int8_t bustype;
406 u_int8_t busstate;
407 u_int16_t reserved;
408 u_int8_t busname[12];
409 } __attribute__ ((__packed__));
410
411 #define I2O_HBA_BUS_GENERIC 0x00
412 #define I2O_HBA_BUS_SCSI 0x01
413 #define I2O_HBA_BUS_FCA 0x10
414
415 #define I2O_PARAM_HBA_SCSI_PORT_INFO 0x0001
416 struct i2o_param_hba_scsi_port_info {
417 u_int8_t physicalif;
418 u_int8_t electricalif;
419 u_int8_t isosynchonrous;
420 u_int8_t connectortype;
421 u_int8_t connectorgender;
422 u_int8_t reserved1;
423 u_int16_t reserved2;
424 u_int32_t maxnumberofdevices;
425 } __attribute__ ((__packed__));
426
427 #define I2O_PARAM_HBA_SCSI_CTLR_INFO 0x0200
428 struct i2o_param_hba_scsi_ctlr_info {
429 u_int8_t scsitype;
430 u_int8_t protection;
431 u_int8_t settings;
432 u_int8_t reserved;
433 u_int32_t initiatorid;
434 u_int64_t scanlun0only;
435 u_int16_t disabledevice;
436 u_int8_t maxoffset;
437 u_int8_t maxdatawidth;
438 u_int64_t maxsyncrate;
439 } __attribute__ ((__packed__));
440
441 /*
442 * ================= Utility messages =================
443 */
444
445 /*
446 * Get parameter group operation.
447 */
448 #define I2O_UTIL_PARAMS_GET 0x06
449 struct i2o_util_params_get {
450 u_int32_t msgflags;
451 u_int32_t msgfunc;
452 u_int32_t msgictx;
453 u_int32_t msgtctx;
454 u_int32_t flags;
455 } __attribute__ ((__packed__));
456
457 #define I2O_PARAMS_OP_FIELD_GET 1
458 #define I2O_PARAMS_OP_LIST_GET 2
459 #define I2O_PARAMS_OP_MORE_GET 3
460 #define I2O_PARAMS_OP_SIZE_GET 4
461 #define I2O_PARAMS_OP_TABLE_GET 5
462 #define I2O_PARAMS_OP_FIELD_SET 6
463 #define I2O_PARAMS_OP_LIST_SET 7
464 #define I2O_PARAMS_OP_ROW_ADD 8
465 #define I2O_PARAMS_OP_ROW_DELETE 9
466 #define I2O_PARAMS_OP_TABLE_CLEAR 10
467
468 struct i2o_param_op_list_header {
469 u_int16_t count;
470 u_int16_t reserved;
471 } __attribute__ ((__packed__));
472
473 struct i2o_param_op_all_template {
474 u_int16_t operation;
475 u_int16_t group;
476 u_int16_t fieldcount;
477 } __attribute__ ((__packed__));
478
479 struct i2o_param_op_results {
480 u_int16_t count;
481 u_int16_t reserved;
482 } __attribute__ ((__packed__));
483
484 struct i2o_param_read_results {
485 u_int16_t blocksize;
486 u_int8_t blockstatus;
487 u_int8_t errorinfosize;
488 } __attribute__ ((__packed__));
489
490 /*
491 * Device claim.
492 */
493 #define I2O_UTIL_CLAIM 0x09
494 struct i2o_util_claim {
495 u_int32_t msgflags;
496 u_int32_t msgfunc;
497 u_int32_t msgictx;
498 u_int32_t msgtctx;
499 u_int32_t flags;
500 } __attribute__ ((__packed__));
501
502 #define I2O_UTIL_CLAIM_RESET_SENSITIVE 0x00000002
503 #define I2O_UTIL_CLAIM_STATE_SENSITIVE 0x00000004
504 #define I2O_UTIL_CLAIM_CAPACITY_SENSITIVE 0x00000008
505 #define I2O_UTIL_CLAIM_NO_PEER_SERVICE 0x00000010
506 #define I2O_UTIL_CLAIM_NO_MANAGEMENT_SERVICE 0x00000020
507 #define I2O_UTIL_CLAIM_PRIMARY_USER 0x01000000
508 #define I2O_UTIL_CLAIM_AUTHORIZED_USER 0x02000000
509 #define I2O_UTIL_CLAIM_SECONDARY_USER 0x03000000
510 #define I2O_UTIL_CLAIM_MANAGEMENT_USER 0x04000000
511
512 /*
513 * ================= Utility parameter groups =================
514 */
515
516 #define I2O_PARAM_DEVICE_IDENTITY 0xf100
517 struct i2o_param_device_identity {
518 u_int32_t classid;
519 u_int16_t ownertid;
520 u_int16_t parenttid;
521 u_int8_t vendorinfo[16];
522 u_int8_t productinfo[16];
523 u_int8_t description[16];
524 u_int8_t revlevel[8];
525 u_int8_t snformat;
526 u_int8_t serialnumber[1];
527 } __attribute__ ((__packed__));
528
529 #define I2O_PARAM_DDM_IDENTITY 0xf101
530 struct i2o_param_ddm_identity {
531 u_int16_t ddmtid;
532 u_int8_t name[24];
533 u_int8_t revlevel[8];
534 u_int8_t snformat;
535 u_int8_t serialnumber[12];
536 } __attribute__ ((__packed__));
537
538 /*
539 * ================= Block storage class messages =================
540 */
541
542 #define I2O_RBS_BLOCK_READ 0x30
543 struct i2o_rbs_block_read {
544 u_int32_t msgflags;
545 u_int32_t msgfunc;
546 u_int32_t msgictx;
547 u_int32_t msgtctx;
548 u_int32_t flags; /* flags, time multipler, read ahead */
549 u_int32_t datasize;
550 u_int32_t lowoffset;
551 u_int32_t highoffset;
552 } __attribute__ ((__packed__));
553
554 #define I2O_RBS_BLOCK_READ_NO_RETRY 0x01
555 #define I2O_RBS_BLOCK_READ_SOLO 0x02
556 #define I2O_RBS_BLOCK_READ_CACHE_READ 0x04
557 #define I2O_RBS_BLOCK_READ_PREFETCH 0x08
558 #define I2O_RBS_BLOCK_READ_CACHE_ONLY 0x10
559
560 #define I2O_RBS_BLOCK_WRITE 0x31
561 struct i2o_rbs_block_write {
562 u_int32_t msgflags;
563 u_int32_t msgfunc;
564 u_int32_t msgictx;
565 u_int32_t msgtctx;
566 u_int32_t flags; /* flags, time multipler */
567 u_int32_t datasize;
568 u_int32_t lowoffset;
569 u_int32_t highoffset;
570 } __attribute__ ((__packed__));
571
572 #define I2O_RBS_BLOCK_WRITE_NO_RETRY 0x01
573 #define I2O_RBS_BLOCK_WRITE_SOLO 0x02
574 #define I2O_RBS_BLOCK_WRITE_CACHE_NONE 0x04
575 #define I2O_RBS_BLOCK_WRITE_CACHE_WT 0x08
576 #define I2O_RBS_BLOCK_WRITE_CACHE_WB 0x10
577
578 #define I2O_RBS_CACHE_FLUSH 0x37
579 struct i2o_rbs_cache_flush {
580 u_int32_t msgflags;
581 u_int32_t msgfunc;
582 u_int32_t msgictx;
583 u_int32_t msgtctx;
584 u_int32_t flags; /* flags, time multipler */
585 } __attribute__ ((__packed__));
586
587 #define I2O_RBS_MEDIA_MOUNT 0x41
588 struct i2o_rbs_media_mount {
589 u_int32_t msgflags;
590 u_int32_t msgfunc;
591 u_int32_t msgictx;
592 u_int32_t msgtctx;
593 u_int32_t mediaid;
594 u_int32_t loadflags;
595 } __attribute__ ((__packed__));
596
597 #define I2O_RBS_MEDIA_EJECT 0x43
598 struct i2o_rbs_media_eject {
599 u_int32_t msgflags;
600 u_int32_t msgfunc;
601 u_int32_t msgictx;
602 u_int32_t msgtctx;
603 u_int32_t mediaid;
604 } __attribute__ ((__packed__));
605
606 #define I2O_RBS_MEDIA_LOCK 0x49
607 struct i2o_rbs_media_lock {
608 u_int32_t msgflags;
609 u_int32_t msgfunc;
610 u_int32_t msgictx;
611 u_int32_t msgtctx;
612 u_int32_t mediaid;
613 } __attribute__ ((__packed__));
614
615 #define I2O_RBS_MEDIA_UNLOCK 0x4b
616 struct i2o_rbs_media_unlock {
617 u_int32_t msgflags;
618 u_int32_t msgfunc;
619 u_int32_t msgictx;
620 u_int32_t msgtctx;
621 u_int32_t mediaid;
622 } __attribute__ ((__packed__));
623
624 /* Standard RBS reply frame. */
625 struct i2o_rbs_reply {
626 u_int32_t msgflags;
627 u_int32_t msgfunc;
628 u_int32_t msgictx;
629 u_int32_t msgtctx;
630 u_int16_t detail;
631 u_int8_t reserved;
632 u_int8_t reqstatus;
633 u_int32_t transfercount;
634 u_int64_t offset; /* Error replies only */
635 } __attribute__ ((__packed__));
636
637 /*
638 * ================= Block storage class parameter groups =================
639 */
640
641 /*
642 * Device information.
643 */
644 #define I2O_PARAM_RBS_DEVICE_INFO 0x0000
645 struct i2o_param_rbs_device_info {
646 u_int8_t type;
647 u_int8_t npaths;
648 u_int16_t powerstate;
649 u_int32_t blocksize;
650 u_int64_t capacity;
651 u_int32_t capabilities;
652 u_int32_t state;
653 } __attribute__ ((__packed__));
654
655 #define I2O_RBS_TYPE_DIRECT 0x00
656 #define I2O_RBS_TYPE_WORM 0x04
657 #define I2O_RBS_TYPE_CDROM 0x05
658 #define I2O_RBS_TYPE_OPTICAL 0x07
659
660 #define I2O_RBS_CAP_CACHING 0x00000001
661 #define I2O_RBS_CAP_MULTI_PATH 0x00000002
662 #define I2O_RBS_CAP_DYNAMIC_CAPACITY 0x00000004
663 #define I2O_RBS_CAP_REMOVEABLE_MEDIA 0x00000008
664 #define I2O_RBS_CAP_REMOVEABLE_DEVICE 0x00000010
665 #define I2O_RBS_CAP_READ_ONLY 0x00000020
666 #define I2O_RBS_CAP_LOCKOUT 0x00000040
667 #define I2O_RBS_CAP_BOOT_BYPASS 0x00000080
668 #define I2O_RBS_CAP_COMPRESSION 0x00000100
669 #define I2O_RBS_CAP_DATA_SECURITY 0x00000200
670 #define I2O_RBS_CAP_RAID 0x00000400
671
672 #define I2O_RBS_STATE_CACHING 0x00000001
673 #define I2O_RBS_STATE_POWERED_ON 0x00000002
674 #define I2O_RBS_STATE_READY 0x00000004
675 #define I2O_RBS_STATE_MEDIA_LOADED 0x00000008
676 #define I2O_RBS_STATE_DEVICE_LOADED 0x00000010
677 #define I2O_RBS_STATE_READ_ONLY 0x00000020
678 #define I2O_RBS_STATE_LOCKOUT 0x00000040
679 #define I2O_RBS_STATE_BOOT_BYPASS 0x00000080
680 #define I2O_RBS_STATE_COMPRESSION 0x00000100
681 #define I2O_RBS_STATE_DATA_SECURITY 0x00000200
682 #define I2O_RBS_STATE_RAID 0x00000400
683
684 /*
685 * Cache control.
686 */
687 #define I2O_PARAM_RBS_CACHE_CONTROL 0x0003
688 struct i2o_param_rbs_cache_control {
689 u_int32_t totalcachesize;
690 u_int32_t readcachesize;
691 u_int32_t writecachesize;
692 u_int8_t writepolicy;
693 u_int8_t readpolicy;
694 u_int8_t errorcorrection;
695 u_int8_t reserved;
696 } __attribute__ ((__packed__));
697
698 /*
699 * ================= SCSI peripheral class messages =================
700 */
701
702 /*
703 * Reset SCSI device.
704 */
705 #define I2O_SCSI_DEVICE_RESET 0x27
706 struct i2o_scsi_device_reset {
707 u_int32_t msgflags;
708 u_int32_t msgfunc;
709 u_int32_t msgictx;
710 u_int32_t msgtctx;
711 } __attribute__ ((__packed__));
712
713 /*
714 * Execute SCSI command.
715 */
716 #define I2O_SCSI_SCB_EXEC 0x81
717 struct i2o_scsi_scb_exec {
718 u_int32_t msgflags;
719 u_int32_t msgfunc;
720 u_int32_t msgictx;
721 u_int32_t msgtctx;
722 u_int32_t flags; /* CDB length and flags */
723 u_int8_t cdb[16];
724 u_int32_t datalen;
725 } __attribute__ ((__packed__));
726
727 #define I2O_SCB_FLAG_SENSE_DATA_IN_MESSAGE 0x00200000
728 #define I2O_SCB_FLAG_SENSE_DATA_IN_BUFFER 0x00600000
729 #define I2O_SCB_FLAG_SIMPLE_QUEUE_TAG 0x00800000
730 #define I2O_SCB_FLAG_HEAD_QUEUE_TAG 0x01000000
731 #define I2O_SCB_FLAG_ORDERED_QUEUE_TAG 0x01800000
732 #define I2O_SCB_FLAG_ACA_QUEUE_TAG 0x02000000
733 #define I2O_SCB_FLAG_ENABLE_DISCONNECT 0x20000000
734 #define I2O_SCB_FLAG_XFER_FROM_DEVICE 0x40000000
735 #define I2O_SCB_FLAG_XFER_TO_DEVICE 0x80000000
736
737 /*
738 * Abort SCSI command.
739 */
740 #define I2O_SCSI_SCB_ABORT 0x83
741 struct i2o_scsi_scb_abort {
742 u_int32_t msgflags;
743 u_int32_t msgfunc;
744 u_int32_t msgictx;
745 u_int32_t msgtctx;
746 u_int32_t tctxabort;
747 } __attribute__ ((__packed__));
748
749
750 /*
751 * SCSI message reply frame.
752 */
753 struct i2o_scsi_reply {
754 u_int32_t msgflags;
755 u_int32_t msgfunc;
756 u_int32_t msgictx;
757 u_int32_t msgtctx;
758 u_int16_t detail;
759 u_int8_t reserved;
760 u_int8_t reqstatus;
761 u_int32_t datalen;
762 u_int32_t senselen;
763 u_int8_t sense[40];
764 } __attribute__ ((__packed__));
765
766 #define I2O_SCSI_DSC_SUCCESS 0x00
767 #define I2O_SCSI_DSC_REQUEST_ABORTED 0x02
768 #define I2O_SCSI_DSC_UNABLE_TO_ABORT 0x03
769 #define I2O_SCSI_DSC_COMPLETE_WITH_ERROR 0x04
770 #define I2O_SCSI_DSC_ADAPTER_BUSY 0x05
771 #define I2O_SCSI_DSC_REQUEST_INVALID 0x06
772 #define I2O_SCSI_DSC_PATH_INVALID 0x07
773 #define I2O_SCSI_DSC_DEVICE_NOT_PRESENT 0x08
774 #define I2O_SCSI_DSC_UNABLE_TO_TERMINATE 0x09
775 #define I2O_SCSI_DSC_SELECTION_TIMEOUT 0x0a
776 #define I2O_SCSI_DSC_COMMAND_TIMEOUT 0x0b
777 #define I2O_SCSI_DSC_MR_MESSAGE_RECEIVED 0x0d
778 #define I2O_SCSI_DSC_SCSI_BUS_RESET 0x0e
779 #define I2O_SCSI_DSC_PARITY_ERROR_FAILURE 0x0f
780 #define I2O_SCSI_DSC_AUTOSENSE_FAILED 0x10
781 #define I2O_SCSI_DSC_NO_ADAPTER 0x11
782 #define I2O_SCSI_DSC_DATA_OVERRUN 0x12
783 #define I2O_SCSI_DSC_UNEXPECTED_BUS_FREE 0x13
784 #define I2O_SCSI_DSC_SEQUENCE_FAILURE 0x14
785 #define I2O_SCSI_DSC_REQUEST_LENGTH_ERROR 0x15
786 #define I2O_SCSI_DSC_PROVIDE_FAILURE 0x16
787 #define I2O_SCSI_DSC_BDR_MESSAGE_SENT 0x17
788 #define I2O_SCSI_DSC_REQUEST_TERMINATED 0x18
789 #define I2O_SCSI_DSC_IDE_MESSAGE_SENT 0x33
790 #define I2O_SCSI_DSC_RESOURCE_UNAVAILABLE 0x34
791 #define I2O_SCSI_DSC_UNACKNOWLEDGED_EVENT 0x35
792 #define I2O_SCSI_DSC_MESSAGE_RECEIVED 0x36
793 #define I2O_SCSI_DSC_INVALID_CDB 0x37
794 #define I2O_SCSI_DSC_LUN_INVALID 0x38
795 #define I2O_SCSI_DSC_SCSI_TID_INVALID 0x39
796 #define I2O_SCSI_DSC_FUNCTION_UNAVAILABLE 0x3a
797 #define I2O_SCSI_DSC_NO_NEXUS 0x3b
798 #define I2O_SCSI_DSC_SCSI_IID_INVALID 0x3c
799 #define I2O_SCSI_DSC_CDB_RECEIVED 0x3d
800 #define I2O_SCSI_DSC_LUN_ALREADY_ENABLED 0x3e
801 #define I2O_SCSI_DSC_BUS_BUSY 0x3f
802 #define I2O_SCSI_DSC_QUEUE_FROZEN 0x40
803
804 /*
805 * ================= SCSI peripheral class parameter groups =================
806 */
807
808 #define I2O_PARAM_SCSI_DEVICE_INFO 0x0000
809 struct i2o_param_scsi_device_info {
810 u_int8_t devicetype;
811 u_int8_t flags;
812 u_int16_t reserved0;
813 u_int32_t identifier;
814 u_int8_t luninfo[8];
815 u_int32_t queuedepth;
816 u_int8_t reserved1;
817 u_int8_t negoffset;
818 u_int8_t negdatawidth;
819 u_int8_t reserved2;
820 u_int64_t negsyncrate;
821 } __attribute__ ((__packed__));
822
823 #endif /* !defined _I2O_I2O_H_ */
824