Home | History | Annotate | Line # | Download | only in i2o
i2o.h revision 1.2
      1 /*	$NetBSD: i2o.h,v 1.2 2000/12/03 13:17:03 ad 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 /* Organisation IDs */
     53 #define	I2O_ORG_DPT			0x001b
     54 #define	I2O_ORG_AMI			0x1000
     55 
     56 /* Macros to assist in building message headers */
     57 #define	I2O_MSGFLAGS(s)		(I2O_VERSION_11 | (sizeof(struct s) << 14))
     58 #define	I2O_MSGFUNC(t, f)	((t) | (I2O_TID_HOST << 12) | ((f) << 24))
     59 
     60 /* Common message function codes with no payload or an undefined payload */
     61 #define	I2O_UTIL_NOP			0x00
     62 #define	I2O_EXEC_IOP_CLEAR		0xbe
     63 #define	I2O_EXEC_SYS_QUIESCE		0xc3
     64 #define	I2O_EXEC_SYS_ENABLE		0xd1
     65 #define	I2O_PRIVATE_MESSAGE		0xff
     66 
     67 /* Device class codes */
     68 #define	I2O_CLASS_EXECUTIVE			0x00
     69 #define	I2O_CLASS_DDM				0x01
     70 #define	I2O_CLASS_RANDOM_BLOCK_STORAGE		0x10
     71 #define	I2O_CLASS_SEQUENTIAL_STORAGE		0x11
     72 #define	I2O_CLASS_LAN				0x20
     73 #define	I2O_CLASS_WAN				0x30
     74 #define	I2O_CLASS_FIBRE_CHANNEL_PORT		0x40
     75 #define	I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL	0x41
     76 #define	I2O_CLASS_SCSI_PERIPHERAL		0x51
     77 #define	I2O_CLASS_ATE_PORT			0x60
     78 #define	I2O_CLASS_ATE_PERIPHERAL		0x61
     79 #define	I2O_CLASS_FLOPPY_CONTROLLER		0x70
     80 #define	I2O_CLASS_FLOPPY_DEVICE			0x71
     81 #define	I2O_CLASS_BUS_ADAPTER_PORT		0x80
     82 
     83 #define	I2O_CLASS_ANY				0xffffffff
     84 
     85 /* Reply status codes */
     86 #define	I2O_STATUS_SUCCESS			0x00
     87 #define	I2O_STATUS_ABORT_DIRTY			0x01
     88 #define	I2O_STATUS_ABORT_NO_DATA_XFER		0x02
     89 #define	I2O_STATUS_ABORT_PARTIAL_XFER		0x03
     90 #define	I2O_STATUS_ERROR_DIRTY			0x04
     91 #define	I2O_STATUS_ERROR_NO_DATA_XFER		0x05
     92 #define	I2O_STATUS_ERROR_PARTIAL_XFER		0x06
     93 #define	I2O_STATUS_PROCESS_ABORT_DIRTY        	0x08
     94 #define	I2O_STATUS_PROCESS_ABORT_NO_DATA_XFER	0x09
     95 #define	I2O_STATUS_PROCESS_ABORT_PARTIAL_XFER	0x0a
     96 #define	I2O_STATUS_TRANSACTION_ERROR		0x0b
     97 #define	I2O_STATUS_PROGRESS_REPORT		0x80
     98 
     99 /* Message versions */
    100 #define	I2O_VERSION_10			0x00
    101 #define	I2O_VERSION_11			0x01
    102 #define	I2O_VERSION_20			0x02
    103 
    104 /* Commonly used TIDs */
    105 #define	I2O_TID_IOP			0
    106 #define	I2O_TID_HOST			1
    107 #define	I2O_TID_NONE			4095
    108 
    109 /* SGL flags.  This list covers only a fraction of the possibilities. */
    110 #define	I2O_SGL_IGNORE			0x00000000
    111 #define	I2O_SGL_SIMPLE			0x10000000
    112 
    113 #define	I2O_SGL_BC_32BIT		0x01000000
    114 #define	I2O_SGL_BC_64BIT		0x02000000
    115 #define	I2O_SGL_BC_96BIT		0x03000000
    116 #define	I2O_SGL_DATA_OUT		0x04000000
    117 #define	I2O_SGL_END_BUFFER		0x40000000
    118 #define	I2O_SGL_END			0x80000000
    119 
    120 /* Serial number formats */
    121 #define	I2O_SNFMT_UNKNOWN		0
    122 #define	I2O_SNFMT_BINARY		1
    123 #define	I2O_SNFMT_ASCII			2
    124 #define	I2O_SNFMT_UNICODE		3
    125 #define	I2O_SNFMT_LAN_MAC		4
    126 #define	I2O_SNFMT_WAN_MAC		5
    127 
    128 /*
    129  * ================= Common structures =================
    130  */
    131 
    132 /*
    133  * Standard I2O message frame.  All message frames begin with this.
    134  *
    135  * Bits  Field          Meaning
    136  * ----  -------------  ----------------------------------------------------
    137  * 0-2   msgflags       Message header version. Must be 001 (little endian).
    138  * 3     msgflags	Reserved.
    139  * 4-7   msgflags       Offset to SGLs expressed as # of 32-bit words.
    140  * 8-15  msgflags       Control flags.
    141  * 16-31 msgflags       Message frame size expressed as # of 32-bit words.
    142  * 0-11  msgfunc	TID of target.
    143  * 12-23 msgfunc        TID of initiator.
    144  * 24-31 msgfunc        Function (i.e., type of message).
    145  */
    146 struct i2o_msg {
    147 	u_int32_t	msgflags;
    148 	u_int32_t	msgfunc;
    149 	u_int32_t	msgictx;	/* Initiator context */
    150 	u_int32_t	msgtctx;	/* Transaction context */
    151 
    152 	/* Message payload */
    153 
    154 } __attribute__ ((__packed__));
    155 
    156 #define	I2O_MSGFLAGS_STATICMF		0x0100
    157 #define	I2O_MSGFLAGS_64BIT		0x0200
    158 #define	I2O_MSGFLAGS_MULTI		0x1000
    159 #define	I2O_MSGFLAGS_CANT_PROCESS	0x2000
    160 #define	I2O_MSGFLAGS_LAST_REPLY		0x4000
    161 #define	I2O_MSGFLAGS_REPLY		0x8000
    162 
    163 /*
    164  * Standard reply frame.  msgflags, msgfunc, msgictx and msgtctx have the
    165  * same meaning as in `struct i2o_msg'.
    166  */
    167 struct i2o_reply {
    168 	u_int32_t	msgflags;
    169 	u_int32_t	msgfunc;
    170 	u_int32_t	msgictx;
    171 	u_int32_t	msgtctx;
    172 	u_int16_t	detail;		/* Detailed status code */
    173 	u_int8_t	reserved;
    174 	u_int8_t	reqstatus;	/* Request status code */
    175 
    176 	/* Reply payload */
    177 
    178 } __attribute__ ((__packed__));
    179 
    180 /*
    181  * Hardware resource table.  Not documented here.
    182  */
    183 struct i2o_hrt_entry {
    184 	u_int32_t	adapterid;
    185 	u_int16_t	controllingtid;
    186 	u_int8_t	busnumber;
    187 	u_int8_t	bustype;
    188 	u_int8_t	businfo[8];
    189 } __attribute__ ((__packed__));
    190 
    191 struct i2o_hrt {
    192 	u_int16_t	numentries;
    193 	u_int8_t	entrysize;
    194 	u_int8_t	hrtversion;
    195 	u_int32_t	changeindicator;
    196 	struct i2o_hrt_entry	entry[1];
    197 } __attribute__ ((__packed__));
    198 
    199 /*
    200  * Logical configuration table entry.  Bitfields are broken down as follows:
    201  *
    202  * Bits   Field           Meaning
    203  * -----  --------------  ---------------------------------------------------
    204  *  0-11  classid         Class ID.
    205  * 12-15  classid         Class version.
    206  *  0-11  usertid         User TID
    207  * 12-23  usertid         Parent TID.
    208  * 24-31  usertid         BIOS info.
    209  */
    210 struct i2o_lct_entry {
    211 	u_int16_t	entrysize;
    212 	u_int16_t	localtid;		/* Bits 0-12 only */
    213 	u_int32_t	changeindicator;
    214 	u_int32_t	deviceflags;
    215 	u_int16_t	classid;
    216 	u_int16_t	orgid;
    217 	u_int32_t	subclassinfo;
    218 	u_int32_t	usertid;
    219 	u_int8_t	identitytag[8];
    220 	u_int32_t	eventcaps;
    221 } __attribute__ ((__packed__));
    222 
    223 /*
    224  * Logical configuration table header.
    225  */
    226 struct i2o_lct {
    227 	u_int16_t	tablesize;
    228 	u_int16_t	flags;
    229 	u_int32_t	iopflags;
    230 	u_int32_t	changeindicator;
    231 	struct i2o_lct_entry	entry[1];
    232 } __attribute__ ((__packed__));
    233 
    234 /*
    235  * IOP system table.  Bitfields are broken down as follows:
    236  *
    237  * Bits   Field           Meaning
    238  * -----  --------------  ---------------------------------------------------
    239  *  0-11  iopid           IOP ID.
    240  * 12-31  iopid           Reserved.
    241  *  0-11  segnumber       Segment number.
    242  * 12-15  segnumber       I2O version.
    243  * 16-23  segnumber       IOP state.
    244  * 24-31  segnumber       Messenger type.
    245  */
    246 struct i2o_systab_entry {
    247 	u_int16_t	orgid;
    248 	u_int16_t	reserved0;
    249 	u_int32_t	iopid;
    250 	u_int32_t	segnumber;
    251 	u_int16_t	inboundmsgframesize;
    252 	u_int16_t	reserved1;
    253 	u_int32_t	lastchanged;
    254 	u_int32_t	iopcaps;
    255 	u_int32_t	inboundmsgportaddresslow;
    256 	u_int32_t	inboundmsgportaddresshigh;
    257 } __attribute__ ((__packed__));
    258 
    259 struct i2o_systab {
    260 	u_int8_t	numentries;
    261 	u_int8_t	version;
    262 	u_int16_t	reserved0;
    263 	u_int32_t	changeindicator;
    264 	u_int32_t	reserved1[2];
    265 	struct	i2o_systab_entry entry[1];
    266 } __attribute__ ((__packed__));
    267 
    268 /*
    269  * IOP status record.  Bitfields are broken down as follows:
    270  *
    271  * Bits   Field           Meaning
    272  * -----  --------------  ---------------------------------------------------
    273  *  0-11  iopid           IOP ID.
    274  * 12-15  iopid           Reserved.
    275  * 16-31  iopid           Host unit ID.
    276  *  0-11  segnumber       Segment number.
    277  * 12-15  segnumber       I2O version.
    278  * 16-23  segnumber       IOP state.
    279  * 24-31  segnumber       Messenger type.
    280  */
    281 struct i2o_status {
    282 	u_int16_t	orgid;
    283 	u_int16_t	reserved0;
    284 	u_int32_t	iopid;
    285 	u_int32_t	segnumber;
    286 	u_int16_t	inboundmframesize;
    287 	u_int8_t	initcode;
    288 	u_int8_t	reserved1;
    289 	u_int32_t	maxinboundmframes;
    290 	u_int32_t	currentinboundmframes;
    291 	u_int32_t	maxoutboundmframes;
    292 	u_int8_t	productid[24];
    293 	u_int32_t	expectedlctsize;
    294 	u_int32_t	iopcaps;
    295 	u_int32_t	desiredprivmemsize;
    296 	u_int32_t	currentprivmemsize;
    297 	u_int32_t	currentprivmembase;
    298 	u_int32_t	desiredpriviosize;
    299 	u_int32_t	currentpriviosize;
    300 	u_int32_t	currentpriviobase;
    301 	u_int8_t	reserved2[3];
    302 	u_int8_t	syncbyte;
    303 } __attribute__ ((__packed__));
    304 
    305 #define	I2O_IOP_STATE_INITIALIZING		0x01
    306 #define	I2O_IOP_STATE_RESET			0x02
    307 #define	I2O_IOP_STATE_HOLD			0x04
    308 #define	I2O_IOP_STATE_READY			0x05
    309 #define	I2O_IOP_STATE_OPERATIONAL		0x08
    310 #define	I2O_IOP_STATE_FAILED			0x10
    311 #define	I2O_IOP_STATE_FAULTED			0x11
    312 
    313 /*
    314  * ================= Executive class messages =================
    315  */
    316 
    317 #define	I2O_EXEC_STATUS_GET		0xa0
    318 struct i2o_exec_status_get {
    319 	u_int32_t	msgflags;
    320 	u_int32_t	msgfunc;
    321 	u_int32_t	reserved[4];
    322 	u_int32_t	addrlow;
    323 	u_int32_t	addrhigh;
    324 	u_int32_t	length;
    325 } __attribute__ ((__packed__));
    326 
    327 #define	I2O_EXEC_OUTBOUND_INIT		0xa1
    328 struct i2o_exec_outbound_init {
    329 	u_int32_t	msgflags;
    330 	u_int32_t	msgfunc;
    331 	u_int32_t	msgictx;
    332 	u_int32_t	msgtctx;
    333 	u_int32_t	pagesize;
    334 	u_int32_t	flags;		/* init code, outbound msg size */
    335 } __attribute__ ((__packed__));
    336 
    337 #define	I2O_EXEC_OUTBOUND_INIT_IN_PROGRESS	1
    338 #define	I2O_EXEC_OUTBOUND_INIT_REJECTED		2
    339 #define	I2O_EXEC_OUTBOUND_INIT_FAILED		3
    340 #define	I2O_EXEC_OUTBOUND_INIT_COMPLETE		4
    341 
    342 #define	I2O_EXEC_LCT_NOTIFY		0xa2
    343 struct i2o_exec_lct_notify {
    344 	u_int32_t	msgflags;
    345 	u_int32_t	msgfunc;
    346 	u_int32_t	msgictx;
    347 	u_int32_t	msgtctx;
    348 	u_int32_t	classid;
    349 	u_int32_t	changeindicator;
    350 } __attribute__ ((__packed__));
    351 
    352 #define	I2O_EXEC_SYS_TAB_SET		0xa3
    353 struct i2o_exec_sys_tab_set {
    354 	u_int32_t	msgflags;
    355 	u_int32_t	msgfunc;
    356 	u_int32_t	msgictx;
    357 	u_int32_t	msgtctx;
    358 	u_int32_t	iopid;
    359 	u_int32_t	segnumber;
    360 } __attribute__ ((__packed__));
    361 
    362 #define	I2O_EXEC_HRT_GET		0xa8
    363 struct i2o_exec_hrt_get {
    364 	u_int32_t	msgflags;
    365 	u_int32_t	msgfunc;
    366 	u_int32_t	msgictx;
    367 	u_int32_t	msgtctx;
    368 } __attribute__ ((__packed__));
    369 
    370 #define	I2O_EXEC_IOP_RESET		0xbd
    371 struct i2o_exec_iop_reset {
    372 	u_int32_t	msgflags;
    373 	u_int32_t	msgfunc;
    374 	u_int32_t	reserved[4];
    375 	u_int32_t	statuslow;
    376 	u_int32_t	statushigh;
    377 } __attribute__ ((__packed__));
    378 
    379 #define	I2O_RESET_IN_PROGRESS		0x01
    380 #define	I2O_RESET_REJECTED		0x02
    381 
    382 /*
    383  * ================= Executive class parameter groups =================
    384  */
    385 
    386 #define	I2O_PARAM_EXEC_LCT_SCALAR	0x0101
    387 #define	I2O_PARAM_EXEC_LCT_TABLE	0x0102
    388 
    389 /*
    390  * ================= HBA class messages =================
    391  */
    392 
    393 #define	I2O_HBA_BUS_SCAN		0x89
    394 struct i2o_hba_bus_scan {
    395 	u_int32_t	msgflags;
    396 	u_int32_t	msgfunc;
    397 	u_int32_t	msgictx;
    398 	u_int32_t	msgtctx;
    399 } __attribute__ ((__packed__));
    400 
    401 /*
    402  * ================= HBA class parameter groups =================
    403  */
    404 
    405 #define	I2O_PARAM_HBA_CTLR_INFO		0x0000
    406 struct i2o_param_hba_ctlr_info {
    407 	u_int8_t	bustype;
    408 	u_int8_t	busstate;
    409 	u_int16_t	reserved;
    410 	u_int8_t	busname[12];
    411 } __attribute__ ((__packed__));
    412 
    413 #define	I2O_HBA_BUS_GENERIC		0x00
    414 #define	I2O_HBA_BUS_SCSI		0x01
    415 #define	I2O_HBA_BUS_FCA			0x10
    416 
    417 #define	I2O_PARAM_HBA_SCSI_PORT_INFO	0x0001
    418 struct i2o_param_hba_scsi_port_info {
    419 	u_int8_t	physicalif;
    420 	u_int8_t	electricalif;
    421 	u_int8_t	isosynchonrous;
    422 	u_int8_t	connectortype;
    423 	u_int8_t	connectorgender;
    424 	u_int8_t	reserved1;
    425 	u_int16_t	reserved2;
    426 	u_int32_t	maxnumberofdevices;
    427 } __attribute__ ((__packed__));
    428 
    429 #define	I2O_PARAM_HBA_SCSI_CTLR_INFO	0x0200
    430 struct i2o_param_hba_scsi_ctlr_info {
    431 	u_int8_t	scsitype;
    432 	u_int8_t	protection;
    433 	u_int8_t	settings;
    434 	u_int8_t	reserved;
    435 	u_int32_t	initiatorid;
    436 	u_int64_t	scanlun0only;
    437 	u_int16_t	disabledevice;
    438 	u_int8_t	maxoffset;
    439 	u_int8_t	maxdatawidth;
    440 	u_int64_t	maxsyncrate;
    441 } __attribute__ ((__packed__));
    442 
    443 /*
    444  * ================= Utility messages =================
    445  */
    446 
    447 #define	I2O_UTIL_ABORT			0x01
    448 struct i2o_util_abort {
    449 	u_int32_t	msgflags;
    450 	u_int32_t	msgfunc;
    451 	u_int32_t	msgictx;
    452 	u_int32_t	msgtctx;
    453 	u_int32_t	flags;		/* abort type and function type */
    454 	u_int32_t	tctxabort;
    455 } __attribute__ ((__packed__));
    456 
    457 #define	I2O_UTIL_ABORT_EXACT		0x00000000
    458 #define	I2O_UTIL_ABORT_FUNCTION		0x00010000
    459 #define	I2O_UTIL_ABORT_TRANSACTION	0x00020000
    460 #define	I2O_UTIL_ABORT_WILD		0x00030000
    461 
    462 #define	I2O_UTIL_ABORT_CLEAN		0x00040000
    463 
    464 struct i2o_util_abort_reply {
    465 	u_int32_t	msgflags;
    466 	u_int32_t	msgfunc;
    467 	u_int32_t	msgictx;
    468 	u_int32_t	msgtctx;
    469 	u_int32_t	count;
    470 } __attribute__ ((__packed__));
    471 
    472 #define	I2O_UTIL_PARAMS_SET		0x05
    473 #define	I2O_UTIL_PARAMS_GET		0x06
    474 struct i2o_util_params_op {
    475 	u_int32_t	msgflags;
    476 	u_int32_t	msgfunc;
    477 	u_int32_t	msgictx;
    478 	u_int32_t	msgtctx;
    479 	u_int32_t	flags;
    480 } __attribute__ ((__packed__));
    481 
    482 #define	I2O_PARAMS_OP_FIELD_GET		1
    483 #define	I2O_PARAMS_OP_LIST_GET		2
    484 #define	I2O_PARAMS_OP_MORE_GET		3
    485 #define	I2O_PARAMS_OP_SIZE_GET		4
    486 #define	I2O_PARAMS_OP_TABLE_GET		5
    487 #define	I2O_PARAMS_OP_FIELD_SET		6
    488 #define	I2O_PARAMS_OP_LIST_SET		7
    489 #define	I2O_PARAMS_OP_ROW_ADD		8
    490 #define	I2O_PARAMS_OP_ROW_DELETE	9
    491 #define	I2O_PARAMS_OP_TABLE_CLEAR	10
    492 
    493 struct i2o_param_op_list_header {
    494 	u_int16_t	count;
    495 	u_int16_t	reserved;
    496 } __attribute__ ((__packed__));
    497 
    498 struct i2o_param_op_all_template {
    499 	u_int16_t	operation;
    500 	u_int16_t	group;
    501 	u_int16_t	fieldcount;
    502 	u_int16_t	fields[1];
    503 } __attribute__ ((__packed__));
    504 
    505 struct i2o_param_op_results {
    506 	u_int16_t	count;
    507 	u_int16_t	reserved;
    508 } __attribute__ ((__packed__));
    509 
    510 struct i2o_param_read_results {
    511 	u_int16_t	blocksize;
    512 	u_int8_t	blockstatus;
    513 	u_int8_t	errorinfosize;
    514 } __attribute__ ((__packed__));
    515 
    516 struct i2o_param_table_results {
    517 	u_int16_t	blocksize;
    518 	u_int8_t	blockstatus;
    519 	u_int8_t	errorinfosize;
    520 	u_int16_t	rowcount;
    521 	u_int16_t	moreflag;
    522 } __attribute__ ((__packed__));
    523 
    524 #define	I2O_UTIL_CLAIM			0x09
    525 struct i2o_util_claim {
    526 	u_int32_t	msgflags;
    527 	u_int32_t	msgfunc;
    528 	u_int32_t	msgictx;
    529 	u_int32_t	msgtctx;
    530 	u_int32_t	flags;
    531 } __attribute__ ((__packed__));
    532 
    533 #define	I2O_UTIL_CLAIM_RESET_SENSITIVE		0x00000002
    534 #define	I2O_UTIL_CLAIM_STATE_SENSITIVE		0x00000004
    535 #define	I2O_UTIL_CLAIM_CAPACITY_SENSITIVE	0x00000008
    536 #define	I2O_UTIL_CLAIM_NO_PEER_SERVICE		0x00000010
    537 #define	I2O_UTIL_CLAIM_NO_MANAGEMENT_SERVICE	0x00000020
    538 
    539 #define	I2O_UTIL_CLAIM_PRIMARY_USER		0x01000000
    540 #define	I2O_UTIL_CLAIM_AUTHORIZED_USER		0x02000000
    541 #define	I2O_UTIL_CLAIM_SECONDARY_USER		0x03000000
    542 #define	I2O_UTIL_CLAIM_MANAGEMENT_USER		0x04000000
    543 
    544 #define	I2O_UTIL_CLAIM_RELEASE		0x0b
    545 struct i2o_util_claim_release {
    546 	u_int32_t	msgflags;
    547 	u_int32_t	msgfunc;
    548 	u_int32_t	msgictx;
    549 	u_int32_t	msgtctx;
    550 	u_int32_t	flags;		/* User flags as per I2O_UTIL_CLAIM */
    551 } __attribute__ ((__packed__));
    552 
    553 #define	I2O_UTIL_CLAIM_RELEASE_CONDITIONAL	0x00000001
    554 
    555 #define	I2O_UTIL_CONFIG_DIALOG		0x10
    556 struct i2o_util_config_dialog {
    557 	u_int32_t	msgflags;
    558 	u_int32_t	msgfunc;
    559 	u_int32_t	msgictx;
    560 	u_int32_t	msgtctx;
    561 	u_int32_t	pageno;
    562 } __attribute__ ((__packed__));
    563 
    564 #define	I2O_UTIL_EVENT_REGISTER		0x13
    565 struct i2o_util_event_register {
    566 	u_int32_t	msgflags;
    567 	u_int32_t	msgfunc;
    568 	u_int32_t	msgictx;
    569 	u_int32_t	msgtctx;
    570 	u_int32_t	eventmask;
    571 } __attribute__ ((__packed__));
    572 
    573 struct i2o_util_event_register_reply {
    574 	u_int32_t	msgflags;
    575 	u_int32_t	msgfunc;
    576 	u_int32_t	msgictx;
    577 	u_int32_t	msgtctx;
    578 	u_int32_t	event;
    579 	u_int32_t	eventdata[1];
    580 } __attribute__ ((__packed__));
    581 
    582 /* Generic events. */
    583 #define	I2O_EVENT_GEN_DEVICE_STATE		0x00400000
    584 #define	I2O_EVENT_GEN_VENDOR_EVENT		0x00800000
    585 #define	I2O_EVENT_GEN_FIELD_MODIFIED		0x01000000
    586 #define	I2O_EVENT_GEN_EVENT_MASK_MODIFIED	0x02000000
    587 #define	I2O_EVENT_GEN_DEVICE_RESET		0x04000000
    588 #define	I2O_EVENT_GEN_CAPABILITY_CHANGE		0x08000000
    589 #define	I2O_EVENT_GEN_LOCK_RELEASE		0x10000000
    590 #define	I2O_EVENT_GEN_NEED_CONFIGURATION	0x20000000
    591 #define	I2O_EVENT_GEN_GENERAL_WARNING		0x40000000
    592 #define	I2O_EVENT_GEN_STATE_CHANGE		0x80000000
    593 
    594 /* Executive class events. */
    595 #define	I2O_EVENT_EXEC_RESOURCE_LIMITS		0x00000001
    596 #define	I2O_EVENT_EXEC_CONNECTION_FAIL		0x00000002
    597 #define	I2O_EVENT_EXEC_ADAPTER_FAULT		0x00000004
    598 #define	I2O_EVENT_EXEC_POWER_FAIL		0x00000008
    599 #define	I2O_EVENT_EXEC_RESET_PENDING		0x00000010
    600 #define	I2O_EVENT_EXEC_RESET_IMMINENT		0x00000020
    601 #define	I2O_EVENT_EXEC_HARDWARE_FAIL		0x00000040
    602 #define	I2O_EVENT_EXEC_XCT_CHANGE		0x00000080
    603 #define	I2O_EVENT_EXEC_NEW_LCT_ENTRY		0x00000100
    604 #define	I2O_EVENT_EXEC_MODIFIED_LCT		0x00000200
    605 #define	I2O_EVENT_EXEC_DDM_AVAILIBILITY		0x00000400
    606 
    607 /*
    608  * ================= Utility parameter groups =================
    609  */
    610 
    611 #define	I2O_PARAM_DEVICE_IDENTITY	0xf100
    612 struct i2o_param_device_identity {
    613 	u_int32_t	classid;
    614 	u_int16_t	ownertid;
    615 	u_int16_t	parenttid;
    616 	u_int8_t	vendorinfo[16];
    617 	u_int8_t	productinfo[16];
    618 	u_int8_t	description[16];
    619 	u_int8_t	revlevel[8];
    620 	u_int8_t	snformat;
    621 	u_int8_t	serialnumber[1];
    622 } __attribute__ ((__packed__));
    623 
    624 #define	I2O_PARAM_DDM_IDENTITY		0xf101
    625 struct i2o_param_ddm_identity {
    626 	u_int16_t	ddmtid;
    627 	u_int8_t	name[24];
    628 	u_int8_t	revlevel[8];
    629 	u_int8_t	snformat;
    630 	u_int8_t	serialnumber[12];
    631 } __attribute__ ((__packed__));
    632 
    633 /*
    634  * ================= Block storage class messages =================
    635  */
    636 
    637 #define	I2O_RBS_BLOCK_READ		0x30
    638 struct i2o_rbs_block_read {
    639 	u_int32_t	msgflags;
    640 	u_int32_t	msgfunc;
    641 	u_int32_t	msgictx;
    642 	u_int32_t	msgtctx;
    643 	u_int32_t	flags;		/* flags, time multipler, read ahead */
    644 	u_int32_t	datasize;
    645 	u_int32_t	lowoffset;
    646 	u_int32_t	highoffset;
    647 } __attribute__ ((__packed__));
    648 
    649 #define	I2O_RBS_BLOCK_READ_NO_RETRY	0x01
    650 #define	I2O_RBS_BLOCK_READ_SOLO		0x02
    651 #define	I2O_RBS_BLOCK_READ_CACHE_READ	0x04
    652 #define	I2O_RBS_BLOCK_READ_PREFETCH	0x08
    653 #define	I2O_RBS_BLOCK_READ_CACHE_ONLY	0x10
    654 
    655 #define	I2O_RBS_BLOCK_WRITE             0x31
    656 struct i2o_rbs_block_write {
    657 	u_int32_t	msgflags;
    658 	u_int32_t	msgfunc;
    659 	u_int32_t	msgictx;
    660 	u_int32_t	msgtctx;
    661 	u_int32_t	flags;		/* flags, time multipler */
    662 	u_int32_t	datasize;
    663 	u_int32_t	lowoffset;
    664 	u_int32_t	highoffset;
    665 } __attribute__ ((__packed__));
    666 
    667 #define	I2O_RBS_BLOCK_WRITE_NO_RETRY	0x01
    668 #define	I2O_RBS_BLOCK_WRITE_SOLO	0x02
    669 #define	I2O_RBS_BLOCK_WRITE_CACHE_NONE	0x04
    670 #define	I2O_RBS_BLOCK_WRITE_CACHE_WT	0x08
    671 #define	I2O_RBS_BLOCK_WRITE_CACHE_WB	0x10
    672 
    673 #define	I2O_RBS_CACHE_FLUSH             0x37
    674 struct i2o_rbs_cache_flush {
    675 	u_int32_t	msgflags;
    676 	u_int32_t	msgfunc;
    677 	u_int32_t	msgictx;
    678 	u_int32_t	msgtctx;
    679 	u_int32_t	flags;		/* flags, time multipler */
    680 } __attribute__ ((__packed__));
    681 
    682 #define	I2O_RBS_MEDIA_MOUNT		0x41
    683 struct i2o_rbs_media_mount {
    684 	u_int32_t	msgflags;
    685 	u_int32_t	msgfunc;
    686 	u_int32_t	msgictx;
    687 	u_int32_t	msgtctx;
    688 	u_int32_t	mediaid;
    689 	u_int32_t	loadflags;
    690 } __attribute__ ((__packed__));
    691 
    692 #define	I2O_RBS_MEDIA_EJECT             0x43
    693 struct i2o_rbs_media_eject {
    694 	u_int32_t	msgflags;
    695 	u_int32_t	msgfunc;
    696 	u_int32_t	msgictx;
    697 	u_int32_t	msgtctx;
    698 	u_int32_t	mediaid;
    699 } __attribute__ ((__packed__));
    700 
    701 #define	I2O_RBS_MEDIA_LOCK		0x49
    702 struct i2o_rbs_media_lock {
    703 	u_int32_t	msgflags;
    704 	u_int32_t	msgfunc;
    705 	u_int32_t	msgictx;
    706 	u_int32_t	msgtctx;
    707 	u_int32_t	mediaid;
    708 } __attribute__ ((__packed__));
    709 
    710 #define	I2O_RBS_MEDIA_UNLOCK		0x4b
    711 struct i2o_rbs_media_unlock {
    712 	u_int32_t	msgflags;
    713 	u_int32_t	msgfunc;
    714 	u_int32_t	msgictx;
    715 	u_int32_t	msgtctx;
    716 	u_int32_t	mediaid;
    717 } __attribute__ ((__packed__));
    718 
    719 /* Standard RBS reply frame. */
    720 struct i2o_rbs_reply {
    721 	u_int32_t	msgflags;
    722 	u_int32_t	msgfunc;
    723 	u_int32_t	msgictx;
    724 	u_int32_t	msgtctx;
    725 	u_int16_t	detail;
    726 	u_int8_t	reserved;
    727 	u_int8_t	reqstatus;
    728 	u_int32_t	transfercount;
    729 	u_int64_t	offset;		/* Error replies only */
    730 } __attribute__ ((__packed__));
    731 
    732 /*
    733  * ================= Block storage class parameter groups =================
    734  */
    735 
    736 #define	I2O_PARAM_RBS_DEVICE_INFO	0x0000
    737 struct i2o_param_rbs_device_info {
    738 	u_int8_t	type;
    739 	u_int8_t	npaths;
    740 	u_int16_t	powerstate;
    741 	u_int32_t	blocksize;
    742 	u_int64_t	capacity;
    743 	u_int32_t	capabilities;
    744 	u_int32_t	state;
    745 } __attribute__ ((__packed__));
    746 
    747 #define	I2O_RBS_TYPE_DIRECT		0x00
    748 #define	I2O_RBS_TYPE_WORM		0x04
    749 #define	I2O_RBS_TYPE_CDROM		0x05
    750 #define	I2O_RBS_TYPE_OPTICAL		0x07
    751 
    752 #define	I2O_RBS_CAP_CACHING		0x00000001
    753 #define	I2O_RBS_CAP_MULTI_PATH		0x00000002
    754 #define	I2O_RBS_CAP_DYNAMIC_CAPACITY	0x00000004
    755 #define	I2O_RBS_CAP_REMOVEABLE_MEDIA	0x00000008
    756 #define	I2O_RBS_CAP_REMOVEABLE_DEVICE	0x00000010
    757 #define	I2O_RBS_CAP_READ_ONLY		0x00000020
    758 #define	I2O_RBS_CAP_LOCKOUT		0x00000040
    759 #define	I2O_RBS_CAP_BOOT_BYPASS		0x00000080
    760 #define	I2O_RBS_CAP_COMPRESSION		0x00000100
    761 #define	I2O_RBS_CAP_DATA_SECURITY	0x00000200
    762 #define	I2O_RBS_CAP_RAID		0x00000400
    763 
    764 #define	I2O_RBS_STATE_CACHING		0x00000001
    765 #define	I2O_RBS_STATE_POWERED_ON	0x00000002
    766 #define	I2O_RBS_STATE_READY		0x00000004
    767 #define	I2O_RBS_STATE_MEDIA_LOADED	0x00000008
    768 #define	I2O_RBS_STATE_DEVICE_LOADED	0x00000010
    769 #define	I2O_RBS_STATE_READ_ONLY		0x00000020
    770 #define	I2O_RBS_STATE_LOCKOUT		0x00000040
    771 #define	I2O_RBS_STATE_BOOT_BYPASS	0x00000080
    772 #define	I2O_RBS_STATE_COMPRESSION	0x00000100
    773 #define	I2O_RBS_STATE_DATA_SECURITY	0x00000200
    774 #define	I2O_RBS_STATE_RAID		0x00000400
    775 
    776 #define	I2O_PARAM_RBS_OPERATION		0x0001
    777 struct i2o_param_rbs_operation {
    778 	u_int8_t	autoreass;
    779 	u_int8_t	reasstolerance;
    780 	u_int8_t	numretries;
    781 	u_int8_t	reserved0;
    782 	u_int32_t	reasssize;
    783 	u_int32_t	expectedtimeout;
    784 	u_int32_t	rwvtimeout;
    785 	u_int32_t	rwvtimeoutbase;
    786 	u_int32_t	timeoutbase;
    787 	u_int32_t	orderedreqdepth;
    788 	u_int32_t	atomicwritesize;
    789 } __attribute__ ((__packed__));
    790 
    791 #define	I2O_PARAM_RBS_CACHE_CONTROL	0x0003
    792 struct i2o_param_rbs_cache_control {
    793 	u_int32_t	totalcachesize;
    794 	u_int32_t	readcachesize;
    795 	u_int32_t	writecachesize;
    796 	u_int8_t	writepolicy;
    797 	u_int8_t	readpolicy;
    798 	u_int8_t	errorcorrection;
    799 	u_int8_t	reserved;
    800 } __attribute__ ((__packed__));
    801 
    802 /*
    803  * ================= SCSI peripheral class messages =================
    804  */
    805 
    806 #define	I2O_SCSI_DEVICE_RESET		0x27
    807 struct i2o_scsi_device_reset {
    808 	u_int32_t	msgflags;
    809 	u_int32_t	msgfunc;
    810 	u_int32_t	msgictx;
    811 	u_int32_t	msgtctx;
    812 } __attribute__ ((__packed__));
    813 
    814 #define	I2O_SCSI_SCB_EXEC		0x81
    815 struct i2o_scsi_scb_exec {
    816 	u_int32_t	msgflags;
    817 	u_int32_t	msgfunc;
    818 	u_int32_t	msgictx;
    819 	u_int32_t	msgtctx;
    820 	u_int32_t	flags;		/* CDB length and flags */
    821 	u_int8_t	cdb[16];
    822 	u_int32_t	datalen;
    823 } __attribute__ ((__packed__));
    824 
    825 #define	I2O_SCB_FLAG_SENSE_DATA_IN_MESSAGE  0x00200000
    826 #define	I2O_SCB_FLAG_SENSE_DATA_IN_BUFFER   0x00600000
    827 #define	I2O_SCB_FLAG_SIMPLE_QUEUE_TAG       0x00800000
    828 #define	I2O_SCB_FLAG_HEAD_QUEUE_TAG         0x01000000
    829 #define	I2O_SCB_FLAG_ORDERED_QUEUE_TAG      0x01800000
    830 #define	I2O_SCB_FLAG_ACA_QUEUE_TAG          0x02000000
    831 #define	I2O_SCB_FLAG_ENABLE_DISCONNECT      0x20000000
    832 #define	I2O_SCB_FLAG_XFER_FROM_DEVICE       0x40000000
    833 #define	I2O_SCB_FLAG_XFER_TO_DEVICE         0x80000000
    834 
    835 #define	I2O_SCSI_SCB_ABORT		0x83
    836 struct i2o_scsi_scb_abort {
    837 	u_int32_t	msgflags;
    838 	u_int32_t	msgfunc;
    839 	u_int32_t	msgictx;
    840 	u_int32_t	msgtctx;
    841 	u_int32_t	tctxabort;
    842 } __attribute__ ((__packed__));
    843 
    844 struct i2o_scsi_reply {
    845 	u_int32_t	msgflags;
    846 	u_int32_t	msgfunc;
    847 	u_int32_t	msgictx;
    848 	u_int32_t	msgtctx;
    849 	u_int16_t	detail;
    850 	u_int8_t	reserved;
    851 	u_int8_t	reqstatus;
    852 	u_int32_t	datalen;
    853 	u_int32_t	senselen;
    854 	u_int8_t	sense[40];
    855 } __attribute__ ((__packed__));
    856 
    857 #define	I2O_SCSI_DSC_SUCCESS                0x00
    858 #define	I2O_SCSI_DSC_REQUEST_ABORTED        0x02
    859 #define	I2O_SCSI_DSC_UNABLE_TO_ABORT        0x03
    860 #define	I2O_SCSI_DSC_COMPLETE_WITH_ERROR    0x04
    861 #define	I2O_SCSI_DSC_ADAPTER_BUSY           0x05
    862 #define	I2O_SCSI_DSC_REQUEST_INVALID        0x06
    863 #define	I2O_SCSI_DSC_PATH_INVALID           0x07
    864 #define	I2O_SCSI_DSC_DEVICE_NOT_PRESENT     0x08
    865 #define	I2O_SCSI_DSC_UNABLE_TO_TERMINATE    0x09
    866 #define	I2O_SCSI_DSC_SELECTION_TIMEOUT      0x0a
    867 #define	I2O_SCSI_DSC_COMMAND_TIMEOUT        0x0b
    868 #define	I2O_SCSI_DSC_MR_MESSAGE_RECEIVED    0x0d
    869 #define	I2O_SCSI_DSC_SCSI_BUS_RESET         0x0e
    870 #define	I2O_SCSI_DSC_PARITY_ERROR_FAILURE   0x0f
    871 #define	I2O_SCSI_DSC_AUTOSENSE_FAILED       0x10
    872 #define	I2O_SCSI_DSC_NO_ADAPTER             0x11
    873 #define	I2O_SCSI_DSC_DATA_OVERRUN           0x12
    874 #define	I2O_SCSI_DSC_UNEXPECTED_BUS_FREE    0x13
    875 #define	I2O_SCSI_DSC_SEQUENCE_FAILURE       0x14
    876 #define	I2O_SCSI_DSC_REQUEST_LENGTH_ERROR   0x15
    877 #define	I2O_SCSI_DSC_PROVIDE_FAILURE        0x16
    878 #define	I2O_SCSI_DSC_BDR_MESSAGE_SENT       0x17
    879 #define	I2O_SCSI_DSC_REQUEST_TERMINATED     0x18
    880 #define	I2O_SCSI_DSC_IDE_MESSAGE_SENT       0x33
    881 #define	I2O_SCSI_DSC_RESOURCE_UNAVAILABLE   0x34
    882 #define	I2O_SCSI_DSC_UNACKNOWLEDGED_EVENT   0x35
    883 #define	I2O_SCSI_DSC_MESSAGE_RECEIVED       0x36
    884 #define	I2O_SCSI_DSC_INVALID_CDB            0x37
    885 #define	I2O_SCSI_DSC_LUN_INVALID            0x38
    886 #define	I2O_SCSI_DSC_SCSI_TID_INVALID       0x39
    887 #define	I2O_SCSI_DSC_FUNCTION_UNAVAILABLE   0x3a
    888 #define	I2O_SCSI_DSC_NO_NEXUS               0x3b
    889 #define	I2O_SCSI_DSC_SCSI_IID_INVALID       0x3c
    890 #define	I2O_SCSI_DSC_CDB_RECEIVED           0x3d
    891 #define	I2O_SCSI_DSC_LUN_ALREADY_ENABLED    0x3e
    892 #define	I2O_SCSI_DSC_BUS_BUSY               0x3f
    893 #define	I2O_SCSI_DSC_QUEUE_FROZEN           0x40
    894 
    895 /*
    896  * ================= SCSI peripheral class parameter groups =================
    897  */
    898 
    899 #define	I2O_PARAM_SCSI_DEVICE_INFO	0x0000
    900 struct i2o_param_scsi_device_info {
    901 	u_int8_t	devicetype;
    902 	u_int8_t	flags;
    903 	u_int16_t	reserved0;
    904 	u_int32_t	identifier;
    905 	u_int8_t	luninfo[8];
    906 	u_int32_t	queuedepth;
    907 	u_int8_t	reserved1;
    908 	u_int8_t	negoffset;
    909 	u_int8_t	negdatawidth;
    910 	u_int8_t	reserved2;
    911 	u_int64_t	negsyncrate;
    912 } __attribute__ ((__packed__));
    913 
    914 #endif	/* !defined _I2O_I2O_H_ */
    915