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