1 /*	$MirOS: src/sys/dev/i2o/i2o.h,v 1.2 2013/10/31 20:06:50 tg Exp $ */
2 /*	$OpenBSD: i2o.h,v 1.7 2004/04/12 22:12:32 jmc Exp $	*/
3 /*	$NetBSD: i2o.h,v 1.3 2001/03/20 13:01:48 ad Exp $	*/
4 
5 /*-
6  * Copyright © 2013
7  *	Thorsten “mirabilos” Glaser <tg@mirbsd.org>
8  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
9  * All rights reserved.
10  *
11  * This code is derived from software contributed to The NetBSD Foundation
12  * by Andrew Doran.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions
16  * are met:
17  * 1. Redistributions of source code must retain the above copyright
18  *    notice, this list of conditions and the following disclaimer.
19  * 2. Redistributions in binary form must reproduce the above copyright
20  *    notice, this list of conditions and the following disclaimer in the
21  *    documentation and/or other materials provided with the distribution.
22  * 3. All advertising materials mentioning features or use of this software
23  *    must display the following acknowledgement:
24  *        This product includes software developed by the NetBSD
25  *        Foundation, Inc. and its contributors.
26  * 4. Neither the name of The NetBSD Foundation nor the names of its
27  *    contributors may be used to endorse or promote products derived
28  *    from this software without specific prior written permission.
29  *
30  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
31  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
32  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
33  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
34  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
35  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
36  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
37  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
38  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
39  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40  * POSSIBILITY OF SUCH DAMAGE.
41  */
42 
43 /*
44  * Structures and constants, as presented by the I2O specification revision
45  * 1.5 (obtainable from http://www.intelligent-io.com/).  Currently, only
46  * what's useful to us is defined in this file.
47  */
48 
49 #ifndef	_I2O_I2O_H_
50 #define	_I2O_I2O_H_
51 
52 /*
53  * ================= Miscellaneous definitions =================
54  */
55 
56 /* Organisation IDs */
57 #define	I2O_ORG_DPT			0x001b
58 #define	I2O_ORG_INTEL			0x0028
59 #define	I2O_ORG_AMI			0x1000
60 
61 /* Macros to assist in building message headers */
62 #define	I2O_MSGFLAGS(s)		(I2O_VERSION_11 | (sizeof(struct s) << 14))
63 #define	I2O_MSGFUNC(t, f)	((t) | (I2O_TID_HOST << 12) | ((f) << 24))
64 
65 /* Common message function codes with no payload or an undefined payload */
66 #define	I2O_UTIL_NOP			0x00
67 #define	I2O_EXEC_IOP_CLEAR		0xbe
68 #define	I2O_EXEC_SYS_QUIESCE		0xc3
69 #define	I2O_EXEC_SYS_ENABLE		0xd1
70 #define	I2O_PRIVATE_MESSAGE		0xff
71 
72 /* Device class codes */
73 #define	I2O_CLASS_EXECUTIVE			0x00
74 #define	I2O_CLASS_DDM				0x01
75 #define	I2O_CLASS_RANDOM_BLOCK_STORAGE		0x10
76 #define	I2O_CLASS_SEQUENTIAL_STORAGE		0x11
77 #define	I2O_CLASS_LAN				0x20
78 #define	I2O_CLASS_WAN				0x30
79 #define	I2O_CLASS_FIBRE_CHANNEL_PORT		0x40
80 #define	I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL	0x41
81 #define	I2O_CLASS_SCSI_PERIPHERAL		0x51
82 #define	I2O_CLASS_ATE_PORT			0x60
83 #define	I2O_CLASS_ATE_PERIPHERAL		0x61
84 #define	I2O_CLASS_FLOPPY_CONTROLLER		0x70
85 #define	I2O_CLASS_FLOPPY_DEVICE			0x71
86 #define	I2O_CLASS_BUS_ADAPTER_PORT		0x80
87 #define	I2O_CLASS_MASK				0xfff
88 
89 #define	I2O_CLASS_ANY				0xffffffff
90 
91 /* Reply status codes */
92 #define	I2O_STATUS_SUCCESS			0x00
93 #define	I2O_STATUS_ABORT_DIRTY			0x01
94 #define	I2O_STATUS_ABORT_NO_DATA_XFER		0x02
95 #define	I2O_STATUS_ABORT_PARTIAL_XFER		0x03
96 #define	I2O_STATUS_ERROR_DIRTY			0x04
97 #define	I2O_STATUS_ERROR_NO_DATA_XFER		0x05
98 #define	I2O_STATUS_ERROR_PARTIAL_XFER		0x06
99 #define	I2O_STATUS_PROCESS_ABORT_DIRTY        	0x08
100 #define	I2O_STATUS_PROCESS_ABORT_NO_DATA_XFER	0x09
101 #define	I2O_STATUS_PROCESS_ABORT_PARTIAL_XFER	0x0a
102 #define	I2O_STATUS_TRANSACTION_ERROR		0x0b
103 #define	I2O_STATUS_PROGRESS_REPORT		0x80
104 
105 /* Detailed status codes */
106 #define	I2O_DSC_SUCCESS				0x00
107 #define	I2O_DSC_BAD_KEY				0x02
108 #define	I2O_DSC_TCL_ERROR			0x03
109 #define	I2O_DSC_REPLY_BUFFER_FULL		0x04
110 #define	I2O_DSC_NO_SUCH_PAGE			0x05
111 #define	I2O_DSC_INSUFFICIENT_RESOURCE_SOFT	0x06
112 #define	I2O_DSC_INSUFFICIENT_RESOURCE_HARD	0x07
113 #define	I2O_DSC_CHAIN_BUFFER_TOO_LARGE		0x09
114 #define	I2O_DSC_UNSUPPORTED_FUNCTION		0x0a
115 #define	I2O_DSC_DEVICE_LOCKED			0x0b
116 #define	I2O_DSC_DEVICE_RESET			0x0c
117 #define	I2O_DSC_INAPPROPRIATE_FUNCTION		0x0d
118 #define	I2O_DSC_INVALID_INITIATOR_ADDRESS	0x0e
119 #define	I2O_DSC_INVALID_MESSAGE_FLAGS		0x0f
120 #define	I2O_DSC_INVALID_OFFSET			0x10
121 #define	I2O_DSC_INVALID_PARAMETER		0x11
122 #define	I2O_DSC_INVALID_REQUEST			0x12
123 #define	I2O_DSC_INVALID_TARGET_ADDRESS		0x13
124 #define	I2O_DSC_MESSAGE_TOO_LARGE		0x14
125 #define	I2O_DSC_MESSAGE_TOO_SMALL		0x15
126 #define	I2O_DSC_MISSING_PARAMETER		0x16
127 #define	I2O_DSC_TIMEOUT				0x17
128 #define	I2O_DSC_UNKNOWN_ERROR			0x18
129 #define	I2O_DSC_UNKNOWN_FUNCTION		0x19
130 #define	I2O_DSC_UNSUPPORTED_VERSION		0x1a
131 #define	I2O_DSC_DEVICE_BUSY			0x1b
132 #define	I2O_DSC_DEVICE_NOT_AVAILABLE		0x1c
133 
134 /* Message versions */
135 #define	I2O_VERSION_10			0x00
136 #define	I2O_VERSION_11			0x01
137 #define	I2O_VERSION_20			0x02
138 
139 /* Commonly used TIDs */
140 #define	I2O_TID_IOP			0
141 #define	I2O_TID_HOST			1
142 #define	I2O_TID_NONE			4095
143 
144 /* SGL flags.  This list covers only a fraction of the possibilities. */
145 #define	I2O_SGL_IGNORE			0x00000000
146 #define	I2O_SGL_SIMPLE			0x10000000
147 #define	I2O_SGL_PAGE_LIST		0x20000000
148 
149 #define	I2O_SGL_BC_32BIT		0x01000000
150 #define	I2O_SGL_BC_64BIT		0x02000000
151 #define	I2O_SGL_BC_96BIT		0x03000000
152 #define	I2O_SGL_DATA_OUT		0x04000000
153 #define	I2O_SGL_END_BUFFER		0x40000000
154 #define	I2O_SGL_END			0x80000000
155 
156 /* Serial number formats */
157 #define	I2O_SNFMT_UNKNOWN		0
158 #define	I2O_SNFMT_BINARY		1
159 #define	I2O_SNFMT_ASCII			2
160 #define	I2O_SNFMT_UNICODE		3
161 #define	I2O_SNFMT_LAN_MAC		4
162 #define	I2O_SNFMT_WAN_MAC		5
163 
164 /*
165  * ================= Common structures =================
166  */
167 
168 /*
169  * Standard I2O message frame.  All message frames begin with this.
170  *
171  * Bits  Field          Meaning
172  * ----  -------------  ----------------------------------------------------
173  * 0-2   msgflags       Message header version. Must be 001 (little endian).
174  * 3     msgflags	Reserved.
175  * 4-7   msgflags       Offset to SGLs expressed as # of 32-bit words.
176  * 8-15  msgflags       Control flags.
177  * 16-31 msgflags       Message frame size expressed as # of 32-bit words.
178  * 0-11  msgfunc	TID of target.
179  * 12-23 msgfunc        TID of initiator.
180  * 24-31 msgfunc        Function (i.e., type of message).
181  */
182 struct i2o_msg {
183 	u_int32_t	msgflags;
184 	u_int32_t	msgfunc;
185 	u_int32_t	msgictx;	/* Initiator context */
186 	u_int32_t	msgtctx;	/* Transaction context */
187 
188 	/* Message payload */
189 
190 } __attribute__((__packed__));
191 
192 #define	I2O_MSGFLAGS_STATICMF		0x0100
193 #define	I2O_MSGFLAGS_64BIT		0x0200
194 #define	I2O_MSGFLAGS_MULTI		0x1000
195 #define	I2O_MSGFLAGS_FAIL		0x2000
196 #define	I2O_MSGFLAGS_LAST_REPLY		0x4000
197 #define	I2O_MSGFLAGS_REPLY		0x8000
198 
199 /*
200  * Standard reply frame.  msgflags, msgfunc, msgictx and msgtctx have the
201  * same meaning as in `struct i2o_msg'.
202  */
203 struct i2o_reply {
204 	u_int32_t	msgflags;
205 	u_int32_t	msgfunc;
206 	u_int32_t	msgictx;
207 	u_int32_t	msgtctx;
208 	u_int16_t	detail;		/* Detailed status code */
209 	u_int8_t	reserved;
210 	u_int8_t	reqstatus;	/* Request status code */
211 
212 	/* Reply payload */
213 
214 } __attribute__((__packed__));
215 
216 /*
217  * Fault notification reply, returned when a message frame can not be
218  * processed (i.e I2O_MSGFLAGS_FAIL is set in the reply).
219  */
220 struct i2o_fault_notify {
221 	u_int32_t	msgflags;
222 	u_int32_t	msgfunc;
223 	u_int32_t	msgictx;
224 	u_int32_t	msgtctx;	/* Not valid! */
225 	u_int8_t	lowestver;
226 	u_int8_t	highestver;
227 	u_int8_t	severity;
228 	u_int8_t	failurecode;
229 	u_int16_t	failingiop;	/* Bits 0-12 only */
230 	u_int16_t	failinghostunit;
231 	u_int32_t	agelimit;
232 	u_int32_t	lowmfa;
233 	u_int32_t	highmfa;
234 };
235 
236 /*
237  * Hardware resource table.  Not documented here.
238  */
239 struct i2o_hrt_entry {
240 	u_int32_t	adapterid;
241 	u_int16_t	controllingtid;
242 	u_int8_t	busnumber;
243 	u_int8_t	bustype;
244 	u_int8_t	businfo[8];
245 } __attribute__((__packed__));
246 
247 struct i2o_hrt {
248 	u_int16_t	numentries;
249 	u_int8_t	entrysize;
250 	u_int8_t	hrtversion;
251 	u_int32_t	changeindicator;
252 	struct i2o_hrt_entry	entry[1];
253 } __attribute__((__packed__));
254 
255 /*
256  * Logical configuration table entry.  Bitfields are broken down as follows:
257  *
258  * Bits   Field           Meaning
259  * -----  --------------  ---------------------------------------------------
260  *  0-11  classid         Class ID.
261  * 12-15  classid         Class version.
262  *  0-11  usertid         User TID
263  * 12-23  usertid         Parent TID.
264  * 24-31  usertid         BIOS info.
265  */
266 struct i2o_lct_entry {
267 	u_int16_t	entrysize;
268 	u_int16_t	localtid;		/* Bits 0-12 only */
269 #define	I2O_LCT_ENTRY_TID_MASK	0xfff
270 	u_int32_t	changeindicator;
271 	u_int32_t	deviceflags;
272 	u_int16_t	classid;
273 	u_int16_t	orgid;
274 	u_int32_t	subclassinfo;
275 	u_int32_t	usertid;
276 	u_int8_t	identitytag[8];
277 	u_int32_t	eventcaps;
278 } __attribute__((__packed__));
279 
280 /*
281  * Logical configuration table header.
282  */
283 struct i2o_lct {
284 	u_int16_t	tablesize;
285 	u_int16_t	flags;
286 	u_int32_t	iopflags;
287 	u_int32_t	changeindicator;
288 	struct i2o_lct_entry	entry[1];
289 } __attribute__((__packed__));
290 
291 /*
292  * IOP system table.  Bitfields are broken down as follows:
293  *
294  * Bits   Field           Meaning
295  * -----  --------------  ---------------------------------------------------
296  *  0-11  iopid           IOP ID.
297  * 12-31  iopid           Reserved.
298  *  0-11  segnumber       Segment number.
299  * 12-15  segnumber       I2O version.
300  * 16-23  segnumber       IOP state.
301  * 24-31  segnumber       Messenger type.
302  */
303 struct i2o_systab_entry {
304 	u_int16_t	orgid;
305 	u_int16_t	reserved0;
306 	u_int32_t	iopid;
307 	u_int32_t	segnumber;
308 	u_int16_t	inboundmsgframesize;
309 	u_int16_t	reserved1;
310 	u_int32_t	lastchanged;
311 	u_int32_t	iopcaps;
312 	u_int32_t	inboundmsgportaddresslow;
313 	u_int32_t	inboundmsgportaddresshigh;
314 } __attribute__((__packed__));
315 
316 struct i2o_systab {
317 	u_int8_t	numentries;
318 	u_int8_t	version;
319 	u_int16_t	reserved0;
320 	u_int32_t	changeindicator;
321 	u_int32_t	reserved1[2];
322 	struct	i2o_systab_entry entry[1];
323 } __attribute__((__packed__));
324 
325 /*
326  * IOP status record.  Bitfields are broken down as follows:
327  *
328  * Bits   Field           Meaning
329  * -----  --------------  ---------------------------------------------------
330  *  0-11  iopid           IOP ID.
331  * 12-15  iopid           Reserved.
332  * 16-31  iopid           Host unit ID.
333  *  0-11  segnumber       Segment number.
334  * 12-15  segnumber       I2O version.
335  * 16-23  segnumber       IOP state.
336  * 24-31  segnumber       Messenger type.
337  */
338 struct i2o_status {
339 	u_int16_t	orgid;
340 	u_int16_t	reserved0;
341 	u_int32_t	iopid;
342 	u_int32_t	segnumber;
343 	u_int16_t	inboundmframesize;
344 	u_int8_t	initcode;
345 	u_int8_t	reserved1;
346 	u_int32_t	maxinboundmframes;
347 	u_int32_t	currentinboundmframes;
348 	u_int32_t	maxoutboundmframes;
349 	u_int8_t	productid[24];
350 	u_int32_t	expectedlctsize;
351 	u_int32_t	iopcaps;
352 	u_int32_t	desiredprivmemsize;
353 	u_int32_t	currentprivmemsize;
354 	u_int32_t	currentprivmembase;
355 	u_int32_t	desiredpriviosize;
356 	u_int32_t	currentpriviosize;
357 	u_int32_t	currentpriviobase;
358 	u_int8_t	reserved2[3];
359 	u_int8_t	syncbyte;
360 } __attribute__((__packed__));
361 
362 #define	I2O_IOP_STATE_INITIALIZING		0x01
363 #define	I2O_IOP_STATE_RESET			0x02
364 #define	I2O_IOP_STATE_HOLD			0x04
365 #define	I2O_IOP_STATE_READY			0x05
366 #define	I2O_IOP_STATE_OPERATIONAL		0x08
367 #define	I2O_IOP_STATE_FAILED			0x10
368 #define	I2O_IOP_STATE_FAULTED			0x11
369 
370 /*
371  * ================= Executive class messages =================
372  */
373 
374 #define	I2O_EXEC_STATUS_GET		0xa0
375 struct i2o_exec_status_get {
376 	u_int32_t	msgflags;
377 	u_int32_t	msgfunc;
378 	u_int32_t	reserved[4];
379 	u_int32_t	addrlow;
380 	u_int32_t	addrhigh;
381 	u_int32_t	length;
382 } __attribute__((__packed__));
383 
384 #define	I2O_EXEC_OUTBOUND_INIT		0xa1
385 struct i2o_exec_outbound_init {
386 	u_int32_t	msgflags;
387 	u_int32_t	msgfunc;
388 	u_int32_t	msgictx;
389 	u_int32_t	msgtctx;
390 	u_int32_t	pagesize;
391 	u_int32_t	flags;		/* init code, outbound msg size */
392 } __attribute__((__packed__));
393 
394 #define	I2O_EXEC_OUTBOUND_INIT_IN_PROGRESS	1
395 #define	I2O_EXEC_OUTBOUND_INIT_REJECTED		2
396 #define	I2O_EXEC_OUTBOUND_INIT_FAILED		3
397 #define	I2O_EXEC_OUTBOUND_INIT_COMPLETE		4
398 
399 #define	I2O_EXEC_LCT_NOTIFY		0xa2
400 struct i2o_exec_lct_notify {
401 	u_int32_t	msgflags;
402 	u_int32_t	msgfunc;
403 	u_int32_t	msgictx;
404 	u_int32_t	msgtctx;
405 	u_int32_t	classid;
406 	u_int32_t	changeindicator;
407 } __attribute__((__packed__));
408 
409 #define	I2O_EXEC_SYS_TAB_SET		0xa3
410 struct i2o_exec_sys_tab_set {
411 	u_int32_t	msgflags;
412 	u_int32_t	msgfunc;
413 	u_int32_t	msgictx;
414 	u_int32_t	msgtctx;
415 	u_int32_t	iopid;
416 	u_int32_t	segnumber;
417 } __attribute__((__packed__));
418 
419 #define	I2O_EXEC_HRT_GET		0xa8
420 struct i2o_exec_hrt_get {
421 	u_int32_t	msgflags;
422 	u_int32_t	msgfunc;
423 	u_int32_t	msgictx;
424 	u_int32_t	msgtctx;
425 } __attribute__((__packed__));
426 
427 #define	I2O_EXEC_IOP_RESET		0xbd
428 struct i2o_exec_iop_reset {
429 	u_int32_t	msgflags;
430 	u_int32_t	msgfunc;
431 	u_int32_t	reserved[4];
432 	u_int32_t	statuslow;
433 	u_int32_t	statushigh;
434 } __attribute__((__packed__));
435 
436 #define	I2O_RESET_IN_PROGRESS		0x01
437 #define	I2O_RESET_REJECTED		0x02
438 
439 /*
440  * ================= Executive class parameter groups =================
441  */
442 
443 #define	I2O_PARAM_EXEC_LCT_SCALAR	0x0101
444 #define	I2O_PARAM_EXEC_LCT_TABLE	0x0102
445 
446 /*
447  * ================= HBA class messages =================
448  */
449 
450 #define	I2O_HBA_BUS_SCAN		0x89
451 struct i2o_hba_bus_scan {
452 	u_int32_t	msgflags;
453 	u_int32_t	msgfunc;
454 	u_int32_t	msgictx;
455 	u_int32_t	msgtctx;
456 } __attribute__((__packed__));
457 
458 /*
459  * ================= HBA class parameter groups =================
460  */
461 
462 #define	I2O_PARAM_HBA_CTLR_INFO		0x0000
463 struct i2o_param_hba_ctlr_info {
464 	u_int8_t	bustype;
465 	u_int8_t	busstate;
466 	u_int16_t	reserved;
467 	u_int8_t	busname[12];
468 } __attribute__((__packed__));
469 
470 #define	I2O_HBA_BUS_GENERIC		0x00
471 #define	I2O_HBA_BUS_SCSI		0x01
472 #define	I2O_HBA_BUS_FCA			0x10
473 
474 #define	I2O_PARAM_HBA_SCSI_PORT_INFO	0x0001
475 struct i2o_param_hba_scsi_port_info {
476 	u_int8_t	physicalif;
477 #define	I2O_PARAM_HBA_SCSI_PORT_GENERIC	0x01
478 #define	I2O_PARAM_HBA_SCSI_PORT_UNKNOWN	0x02
479 #define	I2O_PARAM_HBA_SCSI_PORT_PARINTF	0x03
480 #define	I2O_PARAM_HBA_SCSI_PORT_FCL	0x04
481 #define	I2O_PARAM_HBA_SCSI_PORT_1394	0x05
482 #define	I2O_PARAM_HBA_SCSI_PORT_SSA	0x06
483 	u_int8_t	electricalif;
484 #define	I2O_PARAM_HBA_SCSI_PORT_SE	0x03
485 #define	I2O_PARAM_HBA_SCSI_PORT_DIFF	0x04
486 #define	I2O_PARAM_HBA_SCSI_PORT_LVD	0x05
487 #define	I2O_PARAM_HBA_SCSI_PORT_OPTCL	0x06
488 	u_int8_t	isosynchonrous;
489 	u_int8_t	connectortype;
490 #define	I2O_PARAM_HBA_SCSI_PORT_HDBS50	0x04
491 #define	I2O_PARAM_HBA_SCSI_PORT_HDBU50	0x05
492 #define	I2O_PARAM_HBA_SCSI_PORT_DBS50	0x06
493 #define	I2O_PARAM_HBA_SCSI_PORT_DBU50	0x07
494 #define	I2O_PARAM_HBA_SCSI_PORT_HDBS68	0x08
495 #define	I2O_PARAM_HBA_SCSI_PORT_HDBU68	0x09
496 #define	I2O_PARAM_HBA_SCSI_PORT_SCA1	0x0a
497 #define	I2O_PARAM_HBA_SCSI_PORT_SCA2	0x0b
498 #define	I2O_PARAM_HBA_SCSI_PORT_FCDB9	0x0c
499 #define	I2O_PARAM_HBA_SCSI_PORT_FC	0x0d
500 #define	I2O_PARAM_HBA_SCSI_PORT_FCSCA40	0x0e
501 #define	I2O_PARAM_HBA_SCSI_PORT_FCSCA20	0x0f
502 #define	I2O_PARAM_HBA_SCSI_PORT_FCBNC	0x10
503 	u_int8_t	connectorgender;
504 #define	I2O_PARAM_HBA_SCSI_PORT_FEMALE	0x03
505 #define	I2O_PARAM_HBA_SCSI_PORT_MALE	0x04
506 	u_int8_t	reserved1;
507 	u_int16_t	reserved2;
508 	u_int32_t	maxnumberofdevices;
509 } __attribute__((__packed__));
510 
511 #define	I2O_PARAM_HBA_SCSI_CTLR_INFO	0x0200
512 struct i2o_param_hba_scsi_ctlr_info {
513 	u_int8_t	scsitype;
514 #define	I2O_PARAM_HBA_SCSI_CTRL_SCSI0	0x00
515 #define	I2O_PARAM_HBA_SCSI_CTRL_SCSI1	0x01
516 #define	I2O_PARAM_HBA_SCSI_CTRL_SCSI2	0x02
517 #define	I2O_PARAM_HBA_SCSI_CTRL_SCSI3	0x03
518 	u_int8_t	protection;
519 	u_int8_t	settings;
520 	u_int8_t	reserved;
521 	u_int32_t	initiatorid;
522 	u_int64_t	scanlun0only;
523 	u_int16_t	disabledevice;
524 	u_int8_t	maxoffset;
525 	u_int8_t	maxdatawidth;
526 	u_int64_t	maxsyncrate;
527 } __attribute__((__packed__));
528 
529 
530 /*
531  * ================= Utility messages =================
532  */
533 
534 #define	I2O_UTIL_ABORT			0x01
535 struct i2o_util_abort {
536 	u_int32_t	msgflags;
537 	u_int32_t	msgfunc;
538 	u_int32_t	msgictx;
539 	u_int32_t	msgtctx;
540 	u_int32_t	flags;		/* abort type and function type */
541 	u_int32_t	tctxabort;
542 } __attribute__((__packed__));
543 
544 #define	I2O_UTIL_ABORT_EXACT		0x00000000
545 #define	I2O_UTIL_ABORT_FUNCTION		0x00010000
546 #define	I2O_UTIL_ABORT_TRANSACTION	0x00020000
547 #define	I2O_UTIL_ABORT_WILD		0x00030000
548 
549 #define	I2O_UTIL_ABORT_CLEAN		0x00040000
550 
551 struct i2o_util_abort_reply {
552 	u_int32_t	msgflags;
553 	u_int32_t	msgfunc;
554 	u_int32_t	msgictx;
555 	u_int32_t	msgtctx;
556 	u_int32_t	count;
557 } __attribute__((__packed__));
558 
559 #define	I2O_UTIL_PARAMS_SET		0x05
560 #define	I2O_UTIL_PARAMS_GET		0x06
561 struct i2o_util_params_op {
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;
567 } __attribute__((__packed__));
568 
569 #define	I2O_PARAMS_OP_FIELD_GET		1
570 #define	I2O_PARAMS_OP_LIST_GET		2
571 #define	I2O_PARAMS_OP_MORE_GET		3
572 #define	I2O_PARAMS_OP_SIZE_GET		4
573 #define	I2O_PARAMS_OP_TABLE_GET		5
574 #define	I2O_PARAMS_OP_FIELD_SET		6
575 #define	I2O_PARAMS_OP_LIST_SET		7
576 #define	I2O_PARAMS_OP_ROW_ADD		8
577 #define	I2O_PARAMS_OP_ROW_DELETE	9
578 #define	I2O_PARAMS_OP_TABLE_CLEAR	10
579 
580 struct i2o_param_op_list_header {
581 	u_int16_t	count;
582 	u_int16_t	reserved;
583 } __attribute__((__packed__));
584 
585 struct i2o_param_op_all_template {
586 	u_int16_t	operation;
587 	u_int16_t	group;
588 	u_int16_t	fieldcount;
589 	u_int16_t	fields[1];
590 } __attribute__((__packed__));
591 
592 struct i2o_param_op_results {
593 	u_int16_t	count;
594 	u_int16_t	reserved;
595 } __attribute__((__packed__));
596 
597 struct i2o_param_read_results {
598 	u_int16_t	blocksize;
599 	u_int8_t	blockstatus;
600 	u_int8_t	errorinfosize;
601 } __attribute__((__packed__));
602 
603 struct i2o_param_table_results {
604 	u_int16_t	blocksize;
605 	u_int8_t	blockstatus;
606 	u_int8_t	errorinfosize;
607 	u_int16_t	rowcount;
608 	u_int16_t	moreflag;
609 } __attribute__((__packed__));
610 
611 #define	I2O_UTIL_CLAIM			0x09
612 struct i2o_util_claim {
613 	u_int32_t	msgflags;
614 	u_int32_t	msgfunc;
615 	u_int32_t	msgictx;
616 	u_int32_t	msgtctx;
617 	u_int32_t	flags;
618 } __attribute__((__packed__));
619 
620 #define	I2O_UTIL_CLAIM_RESET_SENSITIVE		0x00000002
621 #define	I2O_UTIL_CLAIM_STATE_SENSITIVE		0x00000004
622 #define	I2O_UTIL_CLAIM_CAPACITY_SENSITIVE	0x00000008
623 #define	I2O_UTIL_CLAIM_NO_PEER_SERVICE		0x00000010
624 #define	I2O_UTIL_CLAIM_NO_MANAGEMENT_SERVICE	0x00000020
625 
626 #define	I2O_UTIL_CLAIM_PRIMARY_USER		0x01000000
627 #define	I2O_UTIL_CLAIM_AUTHORIZED_USER		0x02000000
628 #define	I2O_UTIL_CLAIM_SECONDARY_USER		0x03000000
629 #define	I2O_UTIL_CLAIM_MANAGEMENT_USER		0x04000000
630 
631 #define	I2O_UTIL_CLAIM_RELEASE		0x0b
632 struct i2o_util_claim_release {
633 	u_int32_t	msgflags;
634 	u_int32_t	msgfunc;
635 	u_int32_t	msgictx;
636 	u_int32_t	msgtctx;
637 	u_int32_t	flags;		/* User flags as per I2O_UTIL_CLAIM */
638 } __attribute__((__packed__));
639 
640 #define	I2O_UTIL_CLAIM_RELEASE_CONDITIONAL	0x00000001
641 
642 #define	I2O_UTIL_CONFIG_DIALOG		0x10
643 struct i2o_util_config_dialog {
644 	u_int32_t	msgflags;
645 	u_int32_t	msgfunc;
646 	u_int32_t	msgictx;
647 	u_int32_t	msgtctx;
648 	u_int32_t	pageno;
649 } __attribute__((__packed__));
650 
651 #define	I2O_UTIL_EVENT_REGISTER		0x13
652 struct i2o_util_event_register {
653 	u_int32_t	msgflags;
654 	u_int32_t	msgfunc;
655 	u_int32_t	msgictx;
656 	u_int32_t	msgtctx;
657 	u_int32_t	eventmask;
658 } __attribute__((__packed__));
659 
660 struct i2o_util_event_register_reply {
661 	u_int32_t	msgflags;
662 	u_int32_t	msgfunc;
663 	u_int32_t	msgictx;
664 	u_int32_t	msgtctx;
665 	u_int32_t	event;
666 	u_int32_t	eventdata[1];
667 } __attribute__((__packed__));
668 
669 /* Generic events. */
670 #define	I2O_EVENT_GEN_DEVICE_STATE		0x00400000
671 #define	I2O_EVENT_GEN_VENDOR_EVENT		0x00800000
672 #define	I2O_EVENT_GEN_FIELD_MODIFIED		0x01000000
673 #define	I2O_EVENT_GEN_EVENT_MASK_MODIFIED	0x02000000
674 #define	I2O_EVENT_GEN_DEVICE_RESET		0x04000000
675 #define	I2O_EVENT_GEN_CAPABILITY_CHANGE		0x08000000
676 #define	I2O_EVENT_GEN_LOCK_RELEASE		0x10000000
677 #define	I2O_EVENT_GEN_NEED_CONFIGURATION	0x20000000
678 #define	I2O_EVENT_GEN_GENERAL_WARNING		0x40000000
679 #define	I2O_EVENT_GEN_STATE_CHANGE		0x80000000
680 
681 /* Executive class events. */
682 #define	I2O_EVENT_EXEC_RESOURCE_LIMITS		0x00000001
683 #define	I2O_EVENT_EXEC_CONNECTION_FAIL		0x00000002
684 #define	I2O_EVENT_EXEC_ADAPTER_FAULT		0x00000004
685 #define	I2O_EVENT_EXEC_POWER_FAIL		0x00000008
686 #define	I2O_EVENT_EXEC_RESET_PENDING		0x00000010
687 #define	I2O_EVENT_EXEC_RESET_IMMINENT		0x00000020
688 #define	I2O_EVENT_EXEC_HARDWARE_FAIL		0x00000040
689 #define	I2O_EVENT_EXEC_XCT_CHANGE		0x00000080
690 #define	I2O_EVENT_EXEC_NEW_LCT_ENTRY		0x00000100
691 #define	I2O_EVENT_EXEC_MODIFIED_LCT		0x00000200
692 #define	I2O_EVENT_EXEC_DDM_AVAILIBILITY		0x00000400
693 
694 /* LAN class events. */
695 #define	I2O_EVENT_LAN_LINK_DOWN			0x00000001
696 #define	I2O_EVENT_LAN_LINK_UP			0x00000002
697 #define	I2O_EVENT_LAN_MEDIA_CHANGE		0x00000004
698 
699 /*
700  * ================= Utility parameter groups =================
701  */
702 
703 #define	I2O_PARAM_DEVICE_IDENTITY	0xf100
704 struct i2o_param_device_identity {
705 	u_int32_t	classid;
706 	u_int16_t	ownertid;
707 	u_int16_t	parenttid;
708 	u_int8_t	vendorinfo[16];
709 	u_int8_t	productinfo[16];
710 	u_int8_t	description[16];
711 	u_int8_t	revlevel[8];
712 	u_int8_t	snformat;
713 	u_int8_t	serialnumber[1];
714 } __attribute__((__packed__));
715 
716 #define	I2O_PARAM_DDM_IDENTITY		0xf101
717 struct i2o_param_ddm_identity {
718 	u_int16_t	ddmtid;
719 	u_int8_t	name[24];
720 	u_int8_t	revlevel[8];
721 	u_int8_t	snformat;
722 	u_int8_t	serialnumber[12];
723 } __attribute__((__packed__));
724 
725 /*
726  * ================= Block storage class messages =================
727  */
728 
729 #define	I2O_RBS_BLOCK_READ		0x30
730 struct i2o_rbs_block_read {
731 	u_int32_t	msgflags;
732 	u_int32_t	msgfunc;
733 	u_int32_t	msgictx;
734 	u_int32_t	msgtctx;
735 	u_int32_t	flags;		/* flags, time multipler, read ahead */
736 	u_int32_t	datasize;
737 	u_int32_t	lowoffset;
738 	u_int32_t	highoffset;
739 } __attribute__((__packed__));
740 
741 #define	I2O_RBS_BLOCK_READ_NO_RETRY	0x01
742 #define	I2O_RBS_BLOCK_READ_SOLO		0x02
743 #define	I2O_RBS_BLOCK_READ_CACHE_READ	0x04
744 #define	I2O_RBS_BLOCK_READ_PREFETCH	0x08
745 #define	I2O_RBS_BLOCK_READ_CACHE_ONLY	0x10
746 
747 #define	I2O_RBS_BLOCK_WRITE             0x31
748 struct i2o_rbs_block_write {
749 	u_int32_t	msgflags;
750 	u_int32_t	msgfunc;
751 	u_int32_t	msgictx;
752 	u_int32_t	msgtctx;
753 	u_int32_t	flags;		/* flags, time multipler */
754 	u_int32_t	datasize;
755 	u_int32_t	lowoffset;
756 	u_int32_t	highoffset;
757 } __attribute__((__packed__));
758 
759 #define	I2O_RBS_BLOCK_WRITE_NO_RETRY	0x01
760 #define	I2O_RBS_BLOCK_WRITE_SOLO	0x02
761 #define	I2O_RBS_BLOCK_WRITE_CACHE_NONE	0x04
762 #define	I2O_RBS_BLOCK_WRITE_CACHE_WT	0x08
763 #define	I2O_RBS_BLOCK_WRITE_CACHE_WB	0x10
764 
765 #define	I2O_RBS_CACHE_FLUSH             0x37
766 struct i2o_rbs_cache_flush {
767 	u_int32_t	msgflags;
768 	u_int32_t	msgfunc;
769 	u_int32_t	msgictx;
770 	u_int32_t	msgtctx;
771 	u_int32_t	flags;		/* flags, time multipler */
772 } __attribute__((__packed__));
773 
774 #define	I2O_RBS_MEDIA_MOUNT		0x41
775 struct i2o_rbs_media_mount {
776 	u_int32_t	msgflags;
777 	u_int32_t	msgfunc;
778 	u_int32_t	msgictx;
779 	u_int32_t	msgtctx;
780 	u_int32_t	mediaid;
781 	u_int32_t	loadflags;
782 } __attribute__((__packed__));
783 
784 #define	I2O_RBS_MEDIA_EJECT             0x43
785 struct i2o_rbs_media_eject {
786 	u_int32_t	msgflags;
787 	u_int32_t	msgfunc;
788 	u_int32_t	msgictx;
789 	u_int32_t	msgtctx;
790 	u_int32_t	mediaid;
791 } __attribute__((__packed__));
792 
793 #define	I2O_RBS_MEDIA_LOCK		0x49
794 struct i2o_rbs_media_lock {
795 	u_int32_t	msgflags;
796 	u_int32_t	msgfunc;
797 	u_int32_t	msgictx;
798 	u_int32_t	msgtctx;
799 	u_int32_t	mediaid;
800 } __attribute__((__packed__));
801 
802 #define	I2O_RBS_MEDIA_UNLOCK		0x4b
803 struct i2o_rbs_media_unlock {
804 	u_int32_t	msgflags;
805 	u_int32_t	msgfunc;
806 	u_int32_t	msgictx;
807 	u_int32_t	msgtctx;
808 	u_int32_t	mediaid;
809 } __attribute__((__packed__));
810 
811 /* Standard RBS reply frame. */
812 struct i2o_rbs_reply {
813 	u_int32_t	msgflags;
814 	u_int32_t	msgfunc;
815 	u_int32_t	msgictx;
816 	u_int32_t	msgtctx;
817 	u_int16_t	detail;
818 	u_int8_t	retrycount;
819 	u_int8_t	reqstatus;
820 	u_int32_t	transfercount;
821 	u_int64_t	offset;		/* Error replies only */
822 } __attribute__((__packed__));
823 
824 /*
825  * ================= Block storage class parameter groups =================
826  */
827 
828 #define	I2O_PARAM_RBS_DEVICE_INFO	0x0000
829 struct i2o_param_rbs_device_info {
830 	u_int8_t	type;
831 	u_int8_t	npaths;
832 	u_int16_t	powerstate;
833 	u_int32_t	blocksize;
834 	u_int64_t	capacity;
835 	u_int32_t	capabilities;
836 	u_int32_t	state;
837 } __attribute__((__packed__));
838 
839 #define	I2O_RBS_TYPE_DIRECT		0x00
840 #define	I2O_RBS_TYPE_WORM		0x04
841 #define	I2O_RBS_TYPE_CDROM		0x05
842 #define	I2O_RBS_TYPE_OPTICAL		0x07
843 
844 #define	I2O_RBS_CAP_CACHING		0x00000001
845 #define	I2O_RBS_CAP_MULTI_PATH		0x00000002
846 #define	I2O_RBS_CAP_DYNAMIC_CAPACITY	0x00000004
847 #define	I2O_RBS_CAP_REMOVABLE_MEDIA	0x00000008
848 #define	I2O_RBS_CAP_REMOVABLE_DEVICE	0x00000010
849 #define	I2O_RBS_CAP_READ_ONLY		0x00000020
850 #define	I2O_RBS_CAP_LOCKOUT		0x00000040
851 #define	I2O_RBS_CAP_BOOT_BYPASS		0x00000080
852 #define	I2O_RBS_CAP_COMPRESSION		0x00000100
853 #define	I2O_RBS_CAP_DATA_SECURITY	0x00000200
854 #define	I2O_RBS_CAP_RAID		0x00000400
855 
856 #define	I2O_RBS_STATE_CACHING		0x00000001
857 #define	I2O_RBS_STATE_POWERED_ON	0x00000002
858 #define	I2O_RBS_STATE_READY		0x00000004
859 #define	I2O_RBS_STATE_MEDIA_LOADED	0x00000008
860 #define	I2O_RBS_STATE_DEVICE_LOADED	0x00000010
861 #define	I2O_RBS_STATE_READ_ONLY		0x00000020
862 #define	I2O_RBS_STATE_LOCKOUT		0x00000040
863 #define	I2O_RBS_STATE_BOOT_BYPASS	0x00000080
864 #define	I2O_RBS_STATE_COMPRESSION	0x00000100
865 #define	I2O_RBS_STATE_DATA_SECURITY	0x00000200
866 #define	I2O_RBS_STATE_RAID		0x00000400
867 
868 #define	I2O_PARAM_RBS_OPERATION		0x0001
869 struct i2o_param_rbs_operation {
870 	u_int8_t	autoreass;
871 	u_int8_t	reasstolerance;
872 	u_int8_t	numretries;
873 	u_int8_t	reserved0;
874 	u_int32_t	reasssize;
875 	u_int32_t	expectedtimeout;
876 	u_int32_t	rwvtimeout;
877 	u_int32_t	rwvtimeoutbase;
878 	u_int32_t	timeoutbase;
879 	u_int32_t	orderedreqdepth;
880 	u_int32_t	atomicwritesize;
881 } __attribute__((__packed__));
882 
883 #define	I2O_PARAM_RBS_CACHE_CONTROL	0x0003
884 struct i2o_param_rbs_cache_control {
885 	u_int32_t	totalcachesize;
886 	u_int32_t	readcachesize;
887 	u_int32_t	writecachesize;
888 	u_int8_t	writepolicy;
889 	u_int8_t	readpolicy;
890 	u_int8_t	errorcorrection;
891 	u_int8_t	reserved;
892 } __attribute__((__packed__));
893 
894 /*
895  * ================= SCSI peripheral class messages =================
896  */
897 
898 #define	I2O_SCSI_DEVICE_RESET		0x27
899 struct i2o_scsi_device_reset {
900 	u_int32_t	msgflags;
901 	u_int32_t	msgfunc;
902 	u_int32_t	msgictx;
903 	u_int32_t	msgtctx;
904 } __attribute__((__packed__));
905 
906 #define	I2O_SCSI_SCB_EXEC		0x81
907 struct i2o_scsi_scb_exec {
908 	u_int32_t	msgflags;
909 	u_int32_t	msgfunc;
910 	u_int32_t	msgictx;
911 	u_int32_t	msgtctx;
912 	u_int32_t	flags;		/* CDB length and flags */
913 	u_int8_t	cdb[16];
914 	u_int32_t	datalen;
915 } __attribute__((__packed__));
916 
917 #define	I2O_SCB_FLAG_SENSE_DATA_IN_MESSAGE  0x00200000
918 #define	I2O_SCB_FLAG_SENSE_DATA_IN_BUFFER   0x00600000
919 #define	I2O_SCB_FLAG_SIMPLE_QUEUE_TAG       0x00800000
920 #define	I2O_SCB_FLAG_HEAD_QUEUE_TAG         0x01000000
921 #define	I2O_SCB_FLAG_ORDERED_QUEUE_TAG      0x01800000
922 #define	I2O_SCB_FLAG_ACA_QUEUE_TAG          0x02000000
923 #define	I2O_SCB_FLAG_ENABLE_DISCONNECT      0x20000000
924 #define	I2O_SCB_FLAG_XFER_FROM_DEVICE       0x40000000
925 #define	I2O_SCB_FLAG_XFER_TO_DEVICE         0x80000000
926 
927 #define	I2O_SCSI_SCB_ABORT		0x83
928 struct i2o_scsi_scb_abort {
929 	u_int32_t	msgflags;
930 	u_int32_t	msgfunc;
931 	u_int32_t	msgictx;
932 	u_int32_t	msgtctx;
933 	u_int32_t	tctxabort;
934 } __attribute__((__packed__));
935 
936 struct i2o_scsi_reply {
937 	u_int32_t	msgflags;
938 	u_int32_t	msgfunc;
939 	u_int32_t	msgictx;
940 	u_int32_t	msgtctx;
941 	u_int8_t	scsistatus;
942 	u_int8_t	hbastatus;
943 	u_int8_t	reserved;
944 	u_int8_t	reqstatus;
945 	u_int32_t	datalen;
946 	u_int32_t	senselen;
947 	u_int8_t	sense[40];
948 } __attribute__((__packed__));
949 
950 #define	I2O_SCSI_DSC_SUCCESS                0x00
951 #define	I2O_SCSI_DSC_REQUEST_ABORTED        0x02
952 #define	I2O_SCSI_DSC_UNABLE_TO_ABORT        0x03
953 #define	I2O_SCSI_DSC_COMPLETE_WITH_ERROR    0x04
954 #define	I2O_SCSI_DSC_ADAPTER_BUSY           0x05
955 #define	I2O_SCSI_DSC_REQUEST_INVALID        0x06
956 #define	I2O_SCSI_DSC_PATH_INVALID           0x07
957 #define	I2O_SCSI_DSC_DEVICE_NOT_PRESENT     0x08
958 #define	I2O_SCSI_DSC_UNABLE_TO_TERMINATE    0x09
959 #define	I2O_SCSI_DSC_SELECTION_TIMEOUT      0x0a
960 #define	I2O_SCSI_DSC_COMMAND_TIMEOUT        0x0b
961 #define	I2O_SCSI_DSC_MR_MESSAGE_RECEIVED    0x0d
962 #define	I2O_SCSI_DSC_SCSI_BUS_RESET         0x0e
963 #define	I2O_SCSI_DSC_PARITY_ERROR_FAILURE   0x0f
964 #define	I2O_SCSI_DSC_AUTOSENSE_FAILED       0x10
965 #define	I2O_SCSI_DSC_NO_ADAPTER             0x11
966 #define	I2O_SCSI_DSC_DATA_OVERRUN           0x12
967 #define	I2O_SCSI_DSC_UNEXPECTED_BUS_FREE    0x13
968 #define	I2O_SCSI_DSC_SEQUENCE_FAILURE       0x14
969 #define	I2O_SCSI_DSC_REQUEST_LENGTH_ERROR   0x15
970 #define	I2O_SCSI_DSC_PROVIDE_FAILURE        0x16
971 #define	I2O_SCSI_DSC_BDR_MESSAGE_SENT       0x17
972 #define	I2O_SCSI_DSC_REQUEST_TERMINATED     0x18
973 #define	I2O_SCSI_DSC_IDE_MESSAGE_SENT       0x33
974 #define	I2O_SCSI_DSC_RESOURCE_UNAVAILABLE   0x34
975 #define	I2O_SCSI_DSC_UNACKNOWLEDGED_EVENT   0x35
976 #define	I2O_SCSI_DSC_MESSAGE_RECEIVED       0x36
977 #define	I2O_SCSI_DSC_INVALID_CDB            0x37
978 #define	I2O_SCSI_DSC_LUN_INVALID            0x38
979 #define	I2O_SCSI_DSC_SCSI_TID_INVALID       0x39
980 #define	I2O_SCSI_DSC_FUNCTION_UNAVAILABLE   0x3a
981 #define	I2O_SCSI_DSC_NO_NEXUS               0x3b
982 #define	I2O_SCSI_DSC_SCSI_IID_INVALID       0x3c
983 #define	I2O_SCSI_DSC_CDB_RECEIVED           0x3d
984 #define	I2O_SCSI_DSC_LUN_ALREADY_ENABLED    0x3e
985 #define	I2O_SCSI_DSC_BUS_BUSY               0x3f
986 #define	I2O_SCSI_DSC_QUEUE_FROZEN           0x40
987 
988 /*
989  * ================= SCSI peripheral class parameter groups =================
990  */
991 
992 #define	I2O_PARAM_SCSI_DEVICE_INFO	0x0000
993 struct i2o_param_scsi_device_info {
994 	u_int8_t	devicetype;
995 	u_int8_t	flags;
996 	u_int16_t	reserved0;
997 	u_int32_t	identifier;
998 	u_int8_t	luninfo[8];
999 	u_int32_t	queuedepth;
1000 	u_int8_t	reserved1;
1001 	u_int8_t	negoffset;
1002 	u_int8_t	negdatawidth;
1003 	u_int8_t	reserved2;
1004 	u_int64_t	negsyncrate;
1005 } __attribute__((__packed__));
1006 
1007 /*
1008  * ================= LAN class messages =================
1009  */
1010 
1011 #define	I2O_LAN_PACKET_SEND		0x3b
1012 struct i2o_lan_packet_send {
1013 	u_int32_t	msgflags;
1014 	u_int32_t	msgfunc;
1015 	u_int32_t	msgictx;
1016 	u_int32_t	tcw;
1017 
1018 	/* SGL follows */
1019 };
1020 
1021 #define	I2O_LAN_TCW_ACCESS_PRI_MASK	0x00000007
1022 #define	I2O_LAN_TCW_SUPPRESS_CRC	0x00000008
1023 #define	I2O_LAN_TCW_SUPPRESS_LOOPBACK	0x00000010
1024 #define	I2O_LAN_TCW_CKSUM_NETWORK	0x00000020
1025 #define	I2O_LAN_TCW_CKSUM_TRANSPORT	0x00000040
1026 #define	I2O_LAN_TCW_REPLY_BATCH		0x00000000
1027 #define	I2O_LAN_TCW_REPLY_IMMEDIATELY	0x40000000
1028 #define	I2O_LAN_TCW_REPLY_UNSUCCESSFUL	0x80000000
1029 #define	I2O_LAN_TCW_REPLY_NONE		0xc0000000
1030 
1031 #define	I2O_LAN_SDU_SEND		0x3d
1032 struct i2o_lan_sdu_send {
1033 	u_int32_t	msgflags;
1034 	u_int32_t	msgfunc;
1035 	u_int32_t	msgictx;
1036 	u_int32_t	tcw;		/* As per PACKET_SEND. */
1037 
1038 	/* SGL follows */
1039 };
1040 
1041 struct i2o_lan_send_reply {
1042 	u_int32_t	msgflags;
1043 	u_int32_t	msgfunc;
1044 	u_int32_t	msgictx;
1045 	u_int32_t	trl;
1046 	u_int16_t	detail;
1047 	u_int8_t	reserved;
1048 	u_int8_t	reqstatus;
1049 	u_int32_t	tctx[1];
1050 };
1051 
1052 #define	I2O_LAN_RECEIVE_POST		0x3e
1053 struct i2o_lan_receive_post {
1054 	u_int32_t	msgflags;
1055 	u_int32_t	msgfunc;
1056 	u_int32_t	msgictx;
1057 	u_int32_t	bktcnt;
1058 
1059 	/* SGL follows */
1060 };
1061 
1062 struct i2o_lan_pdb {
1063 	u_int32_t	bctx;
1064 	u_int32_t	pktoff;
1065 	u_int32_t	pktlen;
1066 };
1067 
1068 #define	I2O_LAN_FRAG_VALID		0x00
1069 #define	I2O_LAN_FRAG_VALID_MASK		foo
1070 
1071 struct i2o_lan_receive_reply {
1072 	u_int32_t	msgflags;
1073 	u_int32_t	msgfunc;
1074 	u_int32_t	msgictx;
1075 	u_int8_t	trlcount;
1076 	u_int8_t	trlesize;
1077 	u_int8_t	reserved;
1078 	u_int8_t	trlflags;
1079 	u_int32_t	bucketsleft;
1080 	struct i2o_lan_pdb	pdb[1];
1081 };
1082 
1083 #define	I2O_LAN_RESET			0x35
1084 struct i2o_lan_reset {
1085 	u_int32_t	msgflags;
1086 	u_int32_t	msgfunc;
1087 	u_int32_t	msgictx;
1088 	u_int16_t	reserved;
1089 	u_int16_t	resrcflags;
1090 };
1091 
1092 #define	I2O_LAN_RESRC_RETURN_BUCKETS	0x0001
1093 #define	I2O_LAN_RESRC_RETURN_XMITS	0x0002
1094 
1095 #define	I2O_LAN_SUSPEND			0x37
1096 struct i2o_lan_suspend {
1097 	u_int32_t	msgflags;
1098 	u_int32_t	msgfunc;
1099 	u_int32_t	msgictx;
1100 	u_int16_t	reserved;
1101 	u_int16_t	resrcflags;	/* As per RESET. */
1102 };
1103 
1104 #define	I2O_LAN_DSC_SUCCESS			0x00
1105 #define	I2O_LAN_DSC_DEVICE_FAILURE		0x01
1106 #define	I2O_LAN_DSC_DESTINATION_NOT_FOUND	0x02
1107 #define	I2O_LAN_DSC_TRANSMIT_ERROR		0x03
1108 #define	I2O_LAN_DSC_TRANSMIT_ABORTED		0x04
1109 #define	I2O_LAN_DSC_RECEIVE_ERROR		0x05
1110 #define	I2O_LAN_DSC_RECEIVE_ABORTED		0x06
1111 #define	I2O_LAN_DSC_DMA_ERROR			0x07
1112 #define	I2O_LAN_DSC_BAD_PACKET_DETECTED		0x08
1113 #define	I2O_LAN_DSC_OUT_OF_MEMORY		0x09
1114 #define	I2O_LAN_DSC_BUCKET_OVERRUN		0x0a
1115 #define	I2O_LAN_DSC_IOP_INTERNAL_ERROR		0x0b
1116 #define	I2O_LAN_DSC_CANCELED			0x0c
1117 #define	I2O_LAN_DSC_INVALID_TRANSACTION_CONTEXT	0x0d
1118 #define	I2O_LAN_DSC_DEST_ADDRESS_DETECTED	0x0e
1119 #define	I2O_LAN_DSC_DEST_ADDRESS_OMITTED	0x0f
1120 #define	I2O_LAN_DSC_PARTIAL_PACKET_RETURNED	0x10
1121 #define	I2O_LAN_DSC_TEMP_SUSPENDED_STATE	0x11
1122 
1123 /*
1124  * ================= LAN class parameter groups =================
1125  */
1126 
1127 #define	I2O_PARAM_LAN_DEVICE_INFO	0x0000
1128 struct i2o_param_lan_device_info {
1129 	u_int16_t	lantype;
1130 	u_int16_t	flags;
1131 	u_int8_t	addrfmt;
1132 	u_int8_t	reserved1;
1133 	u_int16_t	reserved2;
1134 	u_int32_t	minpktsize;
1135 	u_int32_t	maxpktsize;
1136 	u_int8_t	hwaddr[8];
1137 	u_int64_t	maxtxbps;
1138 	u_int64_t	maxrxbps;
1139 };
1140 
1141 #define	I2O_LAN_TYPE_ETHERNET		0x0030
1142 #define	I2O_LAN_TYPE_100BASEVG		0x0040
1143 #define	I2O_LAN_TYPE_TOKEN_RING		0x0050
1144 #define	I2O_LAN_TYPE_FDDI		0x0060
1145 #define	I2O_LAN_TYPE_FIBRECHANNEL	0x0070
1146 
1147 #define	I2O_PARAM_LAN_MAC_ADDRESS	0x0001
1148 struct i2o_param_lan_mac_address {
1149 	u_int8_t	activeaddr[8];
1150 	u_int8_t	localaddr[8];
1151 	u_int8_t	addrmask[8];
1152 	u_int8_t	filtermask[4];
1153 	u_int8_t	hwfiltermask[4];
1154 	u_int32_t	maxmcastaddr;
1155 	u_int32_t	maxfilterperfect;
1156 	u_int32_t	maxfilterimperfect;
1157 };
1158 
1159 #define	I2O_PARAM_LAN_MCAST_MAC_ADDRESS	0x0002
1160 /*
1161  * This one's a table, not a scalar.
1162  */
1163 
1164 #define	I2O_PARAM_LAN_BATCH_CONTROL	0x0003
1165 struct i2o_param_lan_batch_control {
1166 	u_int32_t	batchflags;
1167 	u_int32_t	risingloaddly;
1168 	u_int32_t	risingloadthresh;
1169 	u_int32_t	fallingloaddly;
1170 	u_int32_t	fallingloadthresh;
1171 	u_int32_t	maxbatchcount;
1172 	u_int32_t	maxbatchdelay;
1173 	u_int32_t	transcompdelay;
1174 };
1175 
1176 #define	I2O_PARAM_LAN_OPERATION		0x0004
1177 struct i2o_param_lan_operation {
1178 	u_int32_t	pktprepad;
1179 	u_int32_t	userflags;
1180 	u_int32_t	pktorphanlimit;
1181 };
1182 
1183 #define	I2O_PARAM_LAN_MEDIA_OPERATION	0x0005
1184 struct i2o_param_lan_media_operation {
1185 	u_int32_t	connectortype;
1186 	u_int32_t	connectiontype;
1187 	u_int32_t	curtxbps;
1188 	u_int32_t	currxbps;
1189 	u_int8_t	fullduplex;
1190 	u_int8_t	linkstatus;
1191 	u_int8_t	badpkthandling;
1192 };
1193 
1194 #define	I2O_LAN_CONNECTOR_OTHER		0x00
1195 #define	I2O_LAN_CONNECTOR_UNKNOWN	0x01
1196 #define	I2O_LAN_CONNECTOR_AUI		0x02
1197 #define	I2O_LAN_CONNECTOR_UTP		0x03
1198 #define	I2O_LAN_CONNECTOR_BNC		0x04
1199 #define	I2O_LAN_CONNECTOR_RJ45		0x05
1200 #define	I2O_LAN_CONNECTOR_STP_DB9	0x06
1201 #define	I2O_LAN_CONNECTOR_FIBER_MIC	0x07
1202 #define	I2O_LAN_CONNECTOR_APPLE_AUI	0x08
1203 #define	I2O_LAN_CONNECTOR_MII		0x09
1204 #define	I2O_LAN_CONNECTOR_COPPER_DB9	0x0a
1205 #define	I2O_LAN_CONNECTOR_COPPER_AW	0x0b
1206 #define	I2O_LAN_CONNECTOR_OPTICAL_LW	0x0c
1207 #define	I2O_LAN_CONNECTOR_SIP		0x0d
1208 #define	I2O_LAN_CONNECTOR_OPTICAL_SW	0x0e
1209 
1210 #define	I2O_LAN_CONNECTION_UNKNOWN		0x0000
1211 
1212 #define	I2O_LAN_CONNECTION_ETHERNET_AUI		0x0301
1213 #define	I2O_LAN_CONNECTION_ETHERNET_10BASE5	0x0302
1214 #define	I2O_LAN_CONNECTION_ETHERNET_FOIRL	0x0303
1215 #define	I2O_LAN_CONNECTION_ETHERNET_10BASE2	0x0304
1216 #define	I2O_LAN_CONNECTION_ETHERNET_10BROAD36	0x0305
1217 #define	I2O_LAN_CONNECTION_ETHERNET_10BASET	0x0306
1218 #define	I2O_LAN_CONNECTION_ETHERNET_10BASEFP	0x0307
1219 #define	I2O_LAN_CONNECTION_ETHERNET_10BASEFB	0x0308
1220 #define	I2O_LAN_CONNECTION_ETHERNET_10BASEFL	0x0309
1221 #define	I2O_LAN_CONNECTION_ETHERNET_100BASETX	0x030a
1222 #define	I2O_LAN_CONNECTION_ETHERNET_100BASEFX	0x030b
1223 #define	I2O_LAN_CONNECTION_ETHERNET_100BASET4	0x030c
1224 
1225 #define	I2O_LAN_CONNECTION_100BASEVG_100BASEVG	0x0401
1226 
1227 #define	I2O_LAN_CONNECTION_TOKEN_RING_4MBIT	0x0501
1228 #define	I2O_LAN_CONNECTION_TOKEN_RING_16MBIT	0x0502
1229 
1230 #define	I2O_LAN_CONNECTION_FDDI_125MBIT		0x0601
1231 
1232 #define	I2O_LAN_CONNECTION_FIBRECHANNEL_P2P	0x0701
1233 #define	I2O_LAN_CONNECTION_FIBRECHANNEL_AL	0x0702
1234 #define	I2O_LAN_CONNECTION_FIBRECHANNEL_PL	0x0703
1235 #define	I2O_LAN_CONNECTION_FIBRECHANNEL_F	0x0704
1236 
1237 #define	I2O_LAN_CONNECTION_OTHER_EMULATED	0x0f00
1238 #define	I2O_LAN_CONNECTION_OTHER_OTHER		0x0f01
1239 
1240 #endif	/* !defined _I2O_I2O_H_ */
1241