Home | History | Annotate | Line # | Download | only in ic
ispmbox.h revision 1.52.12.1
      1  1.52.12.1     jym /* $NetBSD: ispmbox.h,v 1.52.12.1 2009/07/23 23:31:48 jym Exp $ */
      2       1.26  mjacob /*
      3       1.50  mjacob  * Copyright (C) 1997, 1998, 1999 National Aeronautics & Space Administration
      4       1.50  mjacob  * All rights reserved.
      5       1.26  mjacob  *
      6       1.50  mjacob  * Additional Copyright (C) 2000-2007 by Matthew Jacob
      7        1.1     cgd  * All rights reserved.
      8        1.1     cgd  *
      9        1.1     cgd  * Redistribution and use in source and binary forms, with or without
     10        1.1     cgd  * modification, are permitted provided that the following conditions
     11        1.1     cgd  * are met:
     12        1.1     cgd  * 1. Redistributions of source code must retain the above copyright
     13       1.18  mjacob  *    notice, this list of conditions and the following disclaimer.
     14        1.1     cgd  * 2. Redistributions in binary form must reproduce the above copyright
     15        1.1     cgd  *    notice, this list of conditions and the following disclaimer in the
     16        1.1     cgd  *    documentation and/or other materials provided with the distribution.
     17        1.1     cgd  * 3. The name of the author may not be used to endorse or promote products
     18       1.18  mjacob  *    derived from this software without specific prior written permission
     19        1.6  mjacob  *
     20       1.18  mjacob  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     21       1.18  mjacob  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     22       1.18  mjacob  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     23       1.18  mjacob  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     24       1.18  mjacob  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     25       1.18  mjacob  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26       1.18  mjacob  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27       1.18  mjacob  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     28       1.18  mjacob  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     29       1.18  mjacob  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30       1.18  mjacob  */
     31       1.18  mjacob /*
     32       1.18  mjacob  * Mailbox and Queue Entry Definitions for for Qlogic ISP SCSI adapters.
     33        1.1     cgd  */
     34        1.1     cgd #ifndef	_ISPMBOX_H
     35        1.1     cgd #define	_ISPMBOX_H
     36        1.1     cgd 
     37        1.1     cgd /*
     38        1.1     cgd  * Mailbox Command Opcodes
     39        1.1     cgd  */
     40        1.1     cgd #define MBOX_NO_OP			0x0000
     41        1.1     cgd #define MBOX_LOAD_RAM			0x0001
     42        1.1     cgd #define MBOX_EXEC_FIRMWARE		0x0002
     43        1.1     cgd #define MBOX_DUMP_RAM			0x0003
     44        1.1     cgd #define MBOX_WRITE_RAM_WORD		0x0004
     45        1.1     cgd #define MBOX_READ_RAM_WORD		0x0005
     46        1.1     cgd #define MBOX_MAILBOX_REG_TEST		0x0006
     47        1.1     cgd #define MBOX_VERIFY_CHECKSUM		0x0007
     48        1.1     cgd #define MBOX_ABOUT_FIRMWARE		0x0008
     49       1.50  mjacob #define	MBOX_LOAD_RISC_RAM_2100		0x0009
     50        1.1     cgd 					/*   a */
     51       1.50  mjacob #define	MBOX_LOAD_RISC_RAM		0x000b
     52        1.1     cgd 					/*   c */
     53       1.50  mjacob #define MBOX_WRITE_RAM_WORD_EXTENDED	0x000d
     54        1.1     cgd #define MBOX_CHECK_FIRMWARE		0x000e
     55       1.38  mjacob #define	MBOX_READ_RAM_WORD_EXTENDED	0x000f
     56        1.1     cgd #define MBOX_INIT_REQ_QUEUE		0x0010
     57        1.1     cgd #define MBOX_INIT_RES_QUEUE		0x0011
     58        1.1     cgd #define MBOX_EXECUTE_IOCB		0x0012
     59        1.1     cgd #define MBOX_WAKE_UP			0x0013
     60        1.1     cgd #define MBOX_STOP_FIRMWARE		0x0014
     61        1.1     cgd #define MBOX_ABORT			0x0015
     62        1.1     cgd #define MBOX_ABORT_DEVICE		0x0016
     63        1.1     cgd #define MBOX_ABORT_TARGET		0x0017
     64        1.1     cgd #define MBOX_BUS_RESET			0x0018
     65        1.1     cgd #define MBOX_STOP_QUEUE			0x0019
     66        1.1     cgd #define MBOX_START_QUEUE		0x001a
     67        1.1     cgd #define MBOX_SINGLE_STEP_QUEUE		0x001b
     68        1.1     cgd #define MBOX_ABORT_QUEUE		0x001c
     69        1.1     cgd #define MBOX_GET_DEV_QUEUE_STATUS	0x001d
     70        1.1     cgd 					/*  1e */
     71        1.1     cgd #define MBOX_GET_FIRMWARE_STATUS	0x001f
     72        1.1     cgd #define MBOX_GET_INIT_SCSI_ID		0x0020
     73        1.1     cgd #define MBOX_GET_SELECT_TIMEOUT		0x0021
     74        1.1     cgd #define MBOX_GET_RETRY_COUNT		0x0022
     75        1.1     cgd #define MBOX_GET_TAG_AGE_LIMIT		0x0023
     76        1.1     cgd #define MBOX_GET_CLOCK_RATE		0x0024
     77        1.1     cgd #define MBOX_GET_ACT_NEG_STATE		0x0025
     78        1.1     cgd #define MBOX_GET_ASYNC_DATA_SETUP_TIME	0x0026
     79        1.1     cgd #define MBOX_GET_SBUS_PARAMS		0x0027
     80       1.34  mjacob #define		MBOX_GET_PCI_PARAMS	MBOX_GET_SBUS_PARAMS
     81        1.1     cgd #define MBOX_GET_TARGET_PARAMS		0x0028
     82        1.1     cgd #define MBOX_GET_DEV_QUEUE_PARAMS	0x0029
     83       1.17  mjacob #define	MBOX_GET_RESET_DELAY_PARAMS	0x002a
     84        1.1     cgd 					/*  2b */
     85        1.1     cgd 					/*  2c */
     86        1.1     cgd 					/*  2d */
     87        1.1     cgd 					/*  2e */
     88        1.1     cgd 					/*  2f */
     89        1.1     cgd #define MBOX_SET_INIT_SCSI_ID		0x0030
     90        1.1     cgd #define MBOX_SET_SELECT_TIMEOUT		0x0031
     91        1.1     cgd #define MBOX_SET_RETRY_COUNT		0x0032
     92        1.1     cgd #define MBOX_SET_TAG_AGE_LIMIT		0x0033
     93        1.1     cgd #define MBOX_SET_CLOCK_RATE		0x0034
     94       1.17  mjacob #define MBOX_SET_ACT_NEG_STATE		0x0035
     95        1.1     cgd #define MBOX_SET_ASYNC_DATA_SETUP_TIME	0x0036
     96        1.1     cgd #define MBOX_SET_SBUS_CONTROL_PARAMS	0x0037
     97        1.3  mjacob #define		MBOX_SET_PCI_PARAMETERS	0x0037
     98        1.1     cgd #define MBOX_SET_TARGET_PARAMS		0x0038
     99        1.1     cgd #define MBOX_SET_DEV_QUEUE_PARAMS	0x0039
    100       1.17  mjacob #define	MBOX_SET_RESET_DELAY_PARAMS	0x003a
    101        1.1     cgd 					/*  3b */
    102        1.1     cgd 					/*  3c */
    103        1.1     cgd 					/*  3d */
    104        1.1     cgd 					/*  3e */
    105        1.1     cgd 					/*  3f */
    106        1.1     cgd #define	MBOX_RETURN_BIOS_BLOCK_ADDR	0x0040
    107        1.1     cgd #define	MBOX_WRITE_FOUR_RAM_WORDS	0x0041
    108        1.1     cgd #define	MBOX_EXEC_BIOS_IOCB		0x0042
    109       1.12  mjacob #define	MBOX_SET_FW_FEATURES		0x004a
    110       1.12  mjacob #define	MBOX_GET_FW_FEATURES		0x004b
    111       1.38  mjacob #define		FW_FEATURE_FAST_POST	0x1
    112       1.12  mjacob #define		FW_FEATURE_LVD_NOTIFY	0x2
    113       1.38  mjacob #define		FW_FEATURE_RIO_32BIT	0x4
    114       1.38  mjacob #define		FW_FEATURE_RIO_16BIT	0x8
    115        1.1     cgd 
    116       1.44  mjacob #define	MBOX_INIT_REQ_QUEUE_A64		0x0052
    117       1.44  mjacob #define	MBOX_INIT_RES_QUEUE_A64		0x0053
    118       1.44  mjacob 
    119       1.35  mjacob #define	MBOX_ENABLE_TARGET_MODE		0x0055
    120       1.20  mjacob #define		ENABLE_TARGET_FLAG	0x8000
    121       1.32  mjacob #define		ENABLE_TQING_FLAG	0x0004
    122       1.32  mjacob #define		ENABLE_MANDATORY_DISC	0x0002
    123       1.35  mjacob #define	MBOX_GET_TARGET_STATUS		0x0056
    124       1.35  mjacob 
    125       1.35  mjacob /* These are for the ISP2X00 FC cards */
    126       1.35  mjacob #define	MBOX_GET_LOOP_ID		0x0020
    127       1.51  mjacob /* for 24XX cards, outgoing mailbox 7 has these values for F or FL topologies */
    128       1.51  mjacob #define		ISP24XX_INORDER		0x0100
    129       1.51  mjacob #define		ISP24XX_NPIV_SAN	0x0400
    130       1.51  mjacob #define		ISP24XX_VSAN_SAN	0x1000
    131       1.51  mjacob #define		ISP24XX_FC_SP_SAN	0x2000
    132       1.51  mjacob 
    133       1.35  mjacob #define	MBOX_GET_FIRMWARE_OPTIONS	0x0028
    134       1.35  mjacob #define	MBOX_SET_FIRMWARE_OPTIONS	0x0038
    135       1.35  mjacob #define	MBOX_GET_RESOURCE_COUNT		0x0042
    136       1.50  mjacob #define	MBOX_REQUEST_OFFLINE_MODE	0x0043
    137       1.35  mjacob #define	MBOX_ENHANCED_GET_PDB		0x0047
    138       1.51  mjacob #define	MBOX_INIT_FIRMWARE_MULTI_ID	0x0048	/* 2400 only */
    139       1.51  mjacob #define	MBOX_GET_VP_DATABASE		0x0049	/* 2400 only */
    140       1.51  mjacob #define	MBOX_GET_VP_DATABASE_ENTRY	0x004a	/* 2400 only */
    141       1.35  mjacob #define	MBOX_EXEC_COMMAND_IOCB_A64	0x0054
    142       1.35  mjacob #define	MBOX_INIT_FIRMWARE		0x0060
    143       1.35  mjacob #define	MBOX_GET_INIT_CONTROL_BLOCK	0x0061
    144       1.35  mjacob #define	MBOX_INIT_LIP			0x0062
    145       1.35  mjacob #define	MBOX_GET_FC_AL_POSITION_MAP	0x0063
    146       1.35  mjacob #define	MBOX_GET_PORT_DB		0x0064
    147       1.35  mjacob #define	MBOX_CLEAR_ACA			0x0065
    148       1.35  mjacob #define	MBOX_TARGET_RESET		0x0066
    149       1.35  mjacob #define	MBOX_CLEAR_TASK_SET		0x0067
    150       1.35  mjacob #define	MBOX_ABORT_TASK_SET		0x0068
    151       1.35  mjacob #define	MBOX_GET_FW_STATE		0x0069
    152       1.35  mjacob #define	MBOX_GET_PORT_NAME		0x006A
    153       1.35  mjacob #define	MBOX_GET_LINK_STATUS		0x006B
    154       1.35  mjacob #define	MBOX_INIT_LIP_RESET		0x006C
    155       1.35  mjacob #define	MBOX_SEND_SNS			0x006E
    156       1.35  mjacob #define	MBOX_FABRIC_LOGIN		0x006F
    157       1.35  mjacob #define	MBOX_SEND_CHANGE_REQUEST	0x0070
    158       1.35  mjacob #define	MBOX_FABRIC_LOGOUT		0x0071
    159       1.35  mjacob #define	MBOX_INIT_LIP_LOGIN		0x0072
    160       1.50  mjacob #define	MBOX_LUN_RESET			0x007E
    161       1.41  mjacob 
    162       1.41  mjacob #define	MBOX_DRIVER_HEARTBEAT		0x005B
    163       1.41  mjacob #define	MBOX_FW_HEARTBEAT		0x005C
    164       1.35  mjacob 
    165       1.50  mjacob #define	MBOX_GET_SET_DATA_RATE		0x005D	/* 24XX/23XX only */
    166       1.50  mjacob #define		MBGSD_GET_RATE		0
    167       1.50  mjacob #define		MBGSD_SET_RATE		1
    168       1.50  mjacob #define		MBGSD_SET_RATE_NOW	2	/* 24XX only */
    169       1.35  mjacob #define		MBGSD_ONEGB	0
    170       1.35  mjacob #define		MBGSD_TWOGB	1
    171       1.35  mjacob #define		MBGSD_AUTO	2
    172       1.50  mjacob #define		MBGSD_FOURGB	3		/* 24XX only */
    173  1.52.12.1     jym #define		MBGSD_EIGHTGB	4		/* 25XX only */
    174       1.20  mjacob 
    175        1.3  mjacob 
    176        1.3  mjacob #define	ISP2100_SET_PCI_PARAM		0x00ff
    177        1.3  mjacob 
    178        1.1     cgd #define	MBOX_BUSY			0x04
    179        1.1     cgd 
    180        1.1     cgd /*
    181        1.8  mjacob  * Mailbox Command Complete Status Codes
    182        1.8  mjacob  */
    183        1.8  mjacob #define	MBOX_COMMAND_COMPLETE		0x4000
    184        1.8  mjacob #define	MBOX_INVALID_COMMAND		0x4001
    185        1.8  mjacob #define	MBOX_HOST_INTERFACE_ERROR	0x4002
    186        1.8  mjacob #define	MBOX_TEST_FAILED		0x4003
    187        1.8  mjacob #define	MBOX_COMMAND_ERROR		0x4005
    188        1.8  mjacob #define	MBOX_COMMAND_PARAM_ERROR	0x4006
    189       1.22  mjacob #define	MBOX_PORT_ID_USED		0x4007
    190       1.22  mjacob #define	MBOX_LOOP_ID_USED		0x4008
    191       1.22  mjacob #define	MBOX_ALL_IDS_USED		0x4009
    192       1.22  mjacob #define	MBOX_NOT_LOGGED_IN		0x400A
    193       1.50  mjacob /* pseudo mailbox completion codes */
    194       1.50  mjacob #define	MBOX_REGS_BUSY			0x6000	/* registers in use */
    195       1.50  mjacob #define	MBOX_TIMEOUT			0x6001	/* command timed out */
    196       1.50  mjacob 
    197       1.25  mjacob #define	MBLOGALL			0x000f
    198       1.25  mjacob #define	MBLOGNONE			0x0000
    199       1.25  mjacob #define	MBLOGMASK(x)			((x) & 0xf)
    200        1.8  mjacob 
    201        1.8  mjacob /*
    202        1.8  mjacob  * Asynchronous event status codes
    203        1.8  mjacob  */
    204        1.8  mjacob #define	ASYNC_BUS_RESET			0x8001
    205        1.8  mjacob #define	ASYNC_SYSTEM_ERROR		0x8002
    206        1.8  mjacob #define	ASYNC_RQS_XFER_ERR		0x8003
    207        1.8  mjacob #define	ASYNC_RSP_XFER_ERR		0x8004
    208        1.8  mjacob #define	ASYNC_QWAKEUP			0x8005
    209        1.8  mjacob #define	ASYNC_TIMEOUT_RESET		0x8006
    210       1.10  mjacob #define	ASYNC_DEVICE_RESET		0x8007
    211        1.8  mjacob #define	ASYNC_EXTMSG_UNDERRUN		0x800A
    212        1.8  mjacob #define	ASYNC_SCAM_INT			0x800B
    213        1.8  mjacob #define	ASYNC_HUNG_SCSI			0x800C
    214        1.8  mjacob #define	ASYNC_KILLED_BUS		0x800D
    215        1.8  mjacob #define	ASYNC_BUS_TRANSIT		0x800E	/* LVD -> HVD, eg. */
    216        1.8  mjacob #define	ASYNC_LIP_OCCURRED		0x8010
    217        1.8  mjacob #define	ASYNC_LOOP_UP			0x8011
    218        1.8  mjacob #define	ASYNC_LOOP_DOWN			0x8012
    219        1.8  mjacob #define	ASYNC_LOOP_RESET		0x8013
    220       1.10  mjacob #define	ASYNC_PDB_CHANGED		0x8014
    221        1.8  mjacob #define	ASYNC_CHANGE_NOTIFY		0x8015
    222       1.34  mjacob #define	ASYNC_LIP_F8			0x8016
    223       1.50  mjacob #define	ASYNC_LIP_ERROR			0x8017
    224       1.50  mjacob #define	ASYNC_SECURITY_UPDATE		0x801B
    225       1.33  mjacob #define	ASYNC_CMD_CMPLT			0x8020
    226       1.33  mjacob #define	ASYNC_CTIO_DONE			0x8021
    227       1.33  mjacob #define	ASYNC_IP_XMIT_DONE		0x8022
    228       1.33  mjacob #define	ASYNC_IP_RECV_DONE		0x8023
    229       1.33  mjacob #define	ASYNC_IP_BROADCAST		0x8024
    230       1.33  mjacob #define	ASYNC_IP_RCVQ_LOW		0x8025
    231       1.33  mjacob #define	ASYNC_IP_RCVQ_EMPTY		0x8026
    232       1.33  mjacob #define	ASYNC_IP_RECV_DONE_ALIGNED	0x8027
    233       1.21  mjacob #define	ASYNC_PTPMODE			0x8030
    234       1.33  mjacob #define	ASYNC_RIO1			0x8031
    235       1.33  mjacob #define	ASYNC_RIO2			0x8032
    236       1.33  mjacob #define	ASYNC_RIO3			0x8033
    237       1.33  mjacob #define	ASYNC_RIO4			0x8034
    238       1.33  mjacob #define	ASYNC_RIO5			0x8035
    239       1.21  mjacob #define	ASYNC_CONNMODE			0x8036
    240       1.21  mjacob #define		ISP_CONN_LOOP		1
    241       1.21  mjacob #define		ISP_CONN_PTP		2
    242       1.21  mjacob #define		ISP_CONN_BADLIP		3
    243       1.21  mjacob #define		ISP_CONN_FATAL		4
    244       1.21  mjacob #define		ISP_CONN_LOOPBACK	5
    245       1.33  mjacob #define	ASYNC_RIO_RESP			0x8040
    246       1.33  mjacob #define	ASYNC_RIO_COMP			0x8042
    247       1.50  mjacob #define	ASYNC_RCV_ERR			0x8048
    248       1.50  mjacob 
    249       1.33  mjacob /*
    250       1.33  mjacob  * 2.01.31 2200 Only. Need Bit 13 in Mailbox 1 for Set Firmware Options
    251       1.33  mjacob  * mailbox command to enable this.
    252       1.33  mjacob  */
    253       1.33  mjacob #define	ASYNC_QFULL_SENT		0x8049
    254       1.33  mjacob 
    255       1.33  mjacob /*
    256       1.50  mjacob  * 24XX only
    257       1.33  mjacob  */
    258       1.50  mjacob #define	ASYNC_RJT_SENT			0x8049
    259       1.33  mjacob 
    260       1.50  mjacob /*
    261       1.50  mjacob  * All IOCB Queue entries are this size
    262       1.50  mjacob  */
    263       1.50  mjacob #define	QENTRY_LEN			64
    264       1.21  mjacob 
    265        1.8  mjacob /*
    266       1.51  mjacob  * Special Internal Handle for IOCBs
    267       1.51  mjacob  */
    268       1.51  mjacob #define	ISP_SPCL_HANDLE			0xa5dead5a
    269       1.51  mjacob 
    270       1.51  mjacob /*
    271        1.1     cgd  * Command Structure Definitions
    272        1.1     cgd  */
    273        1.1     cgd 
    274        1.1     cgd typedef struct {
    275       1.50  mjacob 	uint32_t	ds_base;
    276       1.50  mjacob 	uint32_t	ds_count;
    277        1.1     cgd } ispds_t;
    278        1.1     cgd 
    279       1.33  mjacob typedef struct {
    280       1.50  mjacob 	uint32_t	ds_base;
    281       1.50  mjacob 	uint32_t	ds_basehi;
    282       1.50  mjacob 	uint32_t	ds_count;
    283       1.33  mjacob } ispds64_t;
    284       1.33  mjacob 
    285       1.36  mjacob #define	DSTYPE_32BIT	0
    286       1.36  mjacob #define	DSTYPE_64BIT	1
    287       1.33  mjacob typedef struct {
    288       1.50  mjacob 	uint16_t	ds_type;	/* 0-> ispds_t, 1-> ispds64_t */
    289       1.50  mjacob 	uint32_t	ds_segment;	/* unused */
    290       1.50  mjacob 	uint32_t	ds_base;	/* 32 bit address of DSD list */
    291       1.33  mjacob } ispdslist_t;
    292       1.33  mjacob 
    293       1.33  mjacob 
    294        1.1     cgd typedef struct {
    295       1.50  mjacob 	uint8_t		rqs_entry_type;
    296       1.50  mjacob 	uint8_t		rqs_entry_count;
    297       1.50  mjacob 	uint8_t		rqs_seqno;
    298       1.50  mjacob 	uint8_t		rqs_flags;
    299       1.16  mjacob } isphdr_t;
    300        1.1     cgd 
    301        1.1     cgd /* RQS Flag definitions */
    302        1.1     cgd #define	RQSFLAG_CONTINUATION	0x01
    303        1.1     cgd #define	RQSFLAG_FULL		0x02
    304        1.1     cgd #define	RQSFLAG_BADHEADER	0x04
    305        1.1     cgd #define	RQSFLAG_BADPACKET	0x08
    306  1.52.12.1     jym #define	RQSFLAG_BADCOUNT	0x10
    307  1.52.12.1     jym #define	RQSFLAG_BADORDER	0x20
    308  1.52.12.1     jym #define	RQSFLAG_MASK		0x3f
    309        1.3  mjacob 
    310        1.1     cgd /* RQS entry_type definitions */
    311        1.8  mjacob #define	RQSTYPE_REQUEST		0x01
    312        1.8  mjacob #define	RQSTYPE_DATASEG		0x02
    313        1.8  mjacob #define	RQSTYPE_RESPONSE	0x03
    314        1.8  mjacob #define	RQSTYPE_MARKER		0x04
    315        1.8  mjacob #define	RQSTYPE_CMDONLY		0x05
    316        1.8  mjacob #define	RQSTYPE_ATIO		0x06	/* Target Mode */
    317       1.20  mjacob #define	RQSTYPE_CTIO		0x07	/* Target Mode */
    318        1.8  mjacob #define	RQSTYPE_SCAM		0x08
    319        1.8  mjacob #define	RQSTYPE_A64		0x09
    320        1.8  mjacob #define	RQSTYPE_A64_CONT	0x0a
    321        1.8  mjacob #define	RQSTYPE_ENABLE_LUN	0x0b	/* Target Mode */
    322        1.8  mjacob #define	RQSTYPE_MODIFY_LUN	0x0c	/* Target Mode */
    323        1.8  mjacob #define	RQSTYPE_NOTIFY		0x0d	/* Target Mode */
    324        1.8  mjacob #define	RQSTYPE_NOTIFY_ACK	0x0e	/* Target Mode */
    325        1.8  mjacob #define	RQSTYPE_CTIO1		0x0f	/* Target Mode */
    326        1.8  mjacob #define	RQSTYPE_STATUS_CONT	0x10
    327        1.8  mjacob #define	RQSTYPE_T2RQS		0x11
    328       1.50  mjacob #define	RQSTYPE_CTIO7		0x12
    329       1.33  mjacob #define	RQSTYPE_IP_XMIT		0x13
    330       1.50  mjacob #define	RQSTYPE_TSK_MGMT	0x14
    331        1.8  mjacob #define	RQSTYPE_T4RQS		0x15
    332       1.33  mjacob #define	RQSTYPE_ATIO2		0x16	/* Target Mode */
    333       1.33  mjacob #define	RQSTYPE_CTIO2		0x17	/* Target Mode */
    334       1.50  mjacob #define	RQSTYPE_T7RQS		0x18
    335        1.8  mjacob #define	RQSTYPE_T3RQS		0x19
    336       1.33  mjacob #define	RQSTYPE_IP_XMIT_64	0x1b
    337       1.33  mjacob #define	RQSTYPE_CTIO4		0x1e	/* Target Mode */
    338       1.33  mjacob #define	RQSTYPE_CTIO3		0x1f	/* Target Mode */
    339       1.33  mjacob #define	RQSTYPE_RIO1		0x21
    340       1.33  mjacob #define	RQSTYPE_RIO2		0x22
    341       1.33  mjacob #define	RQSTYPE_IP_RECV		0x23
    342       1.33  mjacob #define	RQSTYPE_IP_RECV_CONT	0x24
    343       1.50  mjacob #define	RQSTYPE_CT_PASSTHRU	0x29
    344       1.50  mjacob #define	RQSTYPE_MS_PASSTHRU	0x29
    345       1.51  mjacob #define	RQSTYPE_VP_CTRL		0x30	/* 24XX only */
    346       1.51  mjacob #define	RQSTYPE_VP_MODIFY	0x31	/* 24XX only */
    347       1.51  mjacob #define	RQSTYPE_RPT_ID_ACQ	0x32	/* 24XX only */
    348       1.50  mjacob #define	RQSTYPE_ABORT_IO	0x33
    349       1.50  mjacob #define	RQSTYPE_T6RQS		0x48
    350       1.50  mjacob #define	RQSTYPE_LOGIN		0x52
    351       1.50  mjacob #define	RQSTYPE_ABTS_RCVD	0x54	/* 24XX only */
    352       1.50  mjacob #define	RQSTYPE_ABTS_RSP	0x55	/* 24XX only */
    353        1.1     cgd 
    354        1.1     cgd 
    355        1.1     cgd #define	ISP_RQDSEG	4
    356        1.1     cgd typedef struct {
    357        1.1     cgd 	isphdr_t	req_header;
    358       1.50  mjacob 	uint32_t	req_handle;
    359       1.50  mjacob 	uint8_t		req_lun_trn;
    360       1.50  mjacob 	uint8_t		req_target;
    361       1.50  mjacob 	uint16_t	req_cdblen;
    362       1.50  mjacob 	uint16_t	req_flags;
    363       1.50  mjacob 	uint16_t	req_reserved;
    364       1.50  mjacob 	uint16_t	req_time;
    365       1.50  mjacob 	uint16_t	req_seg_count;
    366       1.50  mjacob 	uint8_t		req_cdb[12];
    367        1.1     cgd 	ispds_t		req_dataseg[ISP_RQDSEG];
    368        1.1     cgd } ispreq_t;
    369       1.50  mjacob #define	ISP_RQDSEG_A64	2
    370       1.44  mjacob 
    371       1.50  mjacob typedef struct {
    372       1.50  mjacob 	isphdr_t	mrk_header;
    373       1.50  mjacob 	uint32_t	mrk_handle;
    374       1.50  mjacob 	uint8_t		mrk_reserved0;
    375       1.50  mjacob 	uint8_t		mrk_target;
    376       1.50  mjacob 	uint16_t	mrk_modifier;
    377       1.50  mjacob 	uint16_t	mrk_flags;
    378       1.50  mjacob 	uint16_t	mrk_lun;
    379       1.50  mjacob 	uint8_t		mrk_reserved1[48];
    380       1.50  mjacob } isp_marker_t;
    381       1.50  mjacob 
    382       1.50  mjacob typedef struct {
    383       1.50  mjacob 	isphdr_t	mrk_header;
    384       1.50  mjacob 	uint32_t	mrk_handle;
    385       1.50  mjacob 	uint16_t	mrk_nphdl;
    386       1.50  mjacob 	uint8_t		mrk_modifier;
    387       1.50  mjacob 	uint8_t		mrk_reserved0;
    388       1.50  mjacob 	uint8_t		mrk_reserved1;
    389       1.50  mjacob 	uint8_t		mrk_vphdl;
    390       1.50  mjacob 	uint16_t	mrk_reserved2;
    391       1.50  mjacob 	uint8_t		mrk_lun[8];
    392       1.50  mjacob 	uint8_t		mrk_reserved3[40];
    393       1.50  mjacob } isp_marker_24xx_t;
    394       1.50  mjacob 
    395        1.1     cgd 
    396       1.16  mjacob #define SYNC_DEVICE	0
    397       1.16  mjacob #define SYNC_TARGET	1
    398       1.16  mjacob #define SYNC_ALL	2
    399       1.50  mjacob #define SYNC_LIP	3
    400       1.16  mjacob 
    401       1.34  mjacob #define	ISP_RQDSEG_T2		3
    402        1.3  mjacob typedef struct {
    403        1.3  mjacob 	isphdr_t	req_header;
    404       1.50  mjacob 	uint32_t	req_handle;
    405       1.50  mjacob 	uint8_t		req_lun_trn;
    406       1.50  mjacob 	uint8_t		req_target;
    407       1.50  mjacob 	uint16_t	req_scclun;
    408       1.50  mjacob 	uint16_t	req_flags;
    409       1.50  mjacob 	uint16_t	req_reserved;
    410       1.50  mjacob 	uint16_t	req_time;
    411       1.50  mjacob 	uint16_t	req_seg_count;
    412       1.50  mjacob 	uint8_t		req_cdb[16];
    413       1.50  mjacob 	uint32_t	req_totalcnt;
    414        1.3  mjacob 	ispds_t		req_dataseg[ISP_RQDSEG_T2];
    415        1.3  mjacob } ispreqt2_t;
    416        1.3  mjacob 
    417       1.50  mjacob typedef struct {
    418       1.50  mjacob 	isphdr_t	req_header;
    419       1.50  mjacob 	uint32_t	req_handle;
    420       1.50  mjacob 	uint16_t	req_target;
    421       1.50  mjacob 	uint16_t	req_scclun;
    422       1.50  mjacob 	uint16_t	req_flags;
    423       1.50  mjacob 	uint16_t	req_reserved;
    424       1.50  mjacob 	uint16_t	req_time;
    425       1.50  mjacob 	uint16_t	req_seg_count;
    426       1.50  mjacob 	uint8_t		req_cdb[16];
    427       1.50  mjacob 	uint32_t	req_totalcnt;
    428       1.50  mjacob 	ispds_t		req_dataseg[ISP_RQDSEG_T2];
    429       1.50  mjacob } ispreqt2e_t;
    430       1.50  mjacob 
    431       1.34  mjacob #define	ISP_RQDSEG_T3		2
    432       1.34  mjacob typedef struct {
    433       1.34  mjacob 	isphdr_t	req_header;
    434       1.50  mjacob 	uint32_t	req_handle;
    435       1.50  mjacob 	uint8_t		req_lun_trn;
    436       1.50  mjacob 	uint8_t		req_target;
    437       1.50  mjacob 	uint16_t	req_scclun;
    438       1.50  mjacob 	uint16_t	req_flags;
    439       1.50  mjacob 	uint16_t	req_reserved;
    440       1.50  mjacob 	uint16_t	req_time;
    441       1.50  mjacob 	uint16_t	req_seg_count;
    442       1.50  mjacob 	uint8_t		req_cdb[16];
    443       1.50  mjacob 	uint32_t	req_totalcnt;
    444       1.34  mjacob 	ispds64_t	req_dataseg[ISP_RQDSEG_T3];
    445       1.34  mjacob } ispreqt3_t;
    446       1.50  mjacob #define	ispreq64_t	ispreqt3_t	/* same as.... */
    447       1.50  mjacob 
    448       1.50  mjacob typedef struct {
    449       1.50  mjacob 	isphdr_t	req_header;
    450       1.50  mjacob 	uint32_t	req_handle;
    451       1.50  mjacob 	uint16_t	req_target;
    452       1.50  mjacob 	uint16_t	req_scclun;
    453       1.50  mjacob 	uint16_t	req_flags;
    454       1.50  mjacob 	uint16_t	req_reserved;
    455       1.50  mjacob 	uint16_t	req_time;
    456       1.50  mjacob 	uint16_t	req_seg_count;
    457       1.50  mjacob 	uint8_t		req_cdb[16];
    458       1.50  mjacob 	uint32_t	req_totalcnt;
    459       1.50  mjacob 	ispds64_t	req_dataseg[ISP_RQDSEG_T3];
    460       1.50  mjacob } ispreqt3e_t;
    461       1.34  mjacob 
    462        1.1     cgd /* req_flag values */
    463        1.1     cgd #define	REQFLAG_NODISCON	0x0001
    464        1.1     cgd #define	REQFLAG_HTAG		0x0002
    465        1.1     cgd #define	REQFLAG_OTAG		0x0004
    466        1.1     cgd #define	REQFLAG_STAG		0x0008
    467        1.1     cgd #define	REQFLAG_TARGET_RTN	0x0010
    468        1.1     cgd 
    469        1.1     cgd #define	REQFLAG_NODATA		0x0000
    470        1.1     cgd #define	REQFLAG_DATA_IN		0x0020
    471        1.1     cgd #define	REQFLAG_DATA_OUT	0x0040
    472        1.1     cgd #define	REQFLAG_DATA_UNKNOWN	0x0060
    473        1.1     cgd 
    474        1.1     cgd #define	REQFLAG_DISARQ		0x0100
    475        1.8  mjacob #define	REQFLAG_FRC_ASYNC	0x0200
    476        1.8  mjacob #define	REQFLAG_FRC_SYNC	0x0400
    477        1.8  mjacob #define	REQFLAG_FRC_WIDE	0x0800
    478        1.8  mjacob #define	REQFLAG_NOPARITY	0x1000
    479        1.8  mjacob #define	REQFLAG_STOPQ		0x2000
    480        1.8  mjacob #define	REQFLAG_XTRASNS		0x4000
    481        1.8  mjacob #define	REQFLAG_PRIORITY	0x8000
    482        1.1     cgd 
    483        1.1     cgd typedef struct {
    484        1.1     cgd 	isphdr_t	req_header;
    485       1.50  mjacob 	uint32_t	req_handle;
    486       1.50  mjacob 	uint8_t		req_lun_trn;
    487       1.50  mjacob 	uint8_t		req_target;
    488       1.50  mjacob 	uint16_t	req_cdblen;
    489       1.50  mjacob 	uint16_t	req_flags;
    490       1.50  mjacob 	uint16_t	req_reserved;
    491       1.50  mjacob 	uint16_t	req_time;
    492       1.50  mjacob 	uint16_t	req_seg_count;
    493       1.50  mjacob 	uint8_t		req_cdb[44];
    494        1.1     cgd } ispextreq_t;
    495        1.1     cgd 
    496       1.50  mjacob /* 24XX only */
    497       1.50  mjacob typedef struct {
    498       1.50  mjacob 	uint16_t	fcd_length;
    499       1.50  mjacob 	uint16_t	fcd_a1500;
    500       1.50  mjacob 	uint16_t	fcd_a3116;
    501       1.50  mjacob 	uint16_t	fcd_a4732;
    502       1.50  mjacob 	uint16_t	fcd_a6348;
    503       1.50  mjacob } fcp_cmnd_ds_t;
    504       1.50  mjacob 
    505       1.50  mjacob typedef struct {
    506       1.50  mjacob 	isphdr_t	req_header;
    507       1.50  mjacob 	uint32_t	req_handle;
    508       1.50  mjacob 	uint16_t	req_nphdl;
    509       1.50  mjacob 	uint16_t	req_time;
    510       1.50  mjacob 	uint16_t	req_seg_count;
    511       1.50  mjacob 	uint16_t	req_fc_rsp_dsd_length;
    512       1.50  mjacob 	uint8_t		req_lun[8];
    513       1.50  mjacob 	uint16_t	req_flags;
    514       1.50  mjacob 	uint16_t	req_fc_cmnd_dsd_length;
    515       1.50  mjacob 	uint16_t	req_fc_cmnd_dsd_a1500;
    516       1.50  mjacob 	uint16_t	req_fc_cmnd_dsd_a3116;
    517       1.50  mjacob 	uint16_t	req_fc_cmnd_dsd_a4732;
    518       1.50  mjacob 	uint16_t	req_fc_cmnd_dsd_a6348;
    519       1.50  mjacob 	uint16_t	req_fc_rsp_dsd_a1500;
    520       1.50  mjacob 	uint16_t	req_fc_rsp_dsd_a3116;
    521       1.50  mjacob 	uint16_t	req_fc_rsp_dsd_a4732;
    522       1.50  mjacob 	uint16_t	req_fc_rsp_dsd_a6348;
    523       1.50  mjacob 	uint32_t	req_totalcnt;
    524       1.50  mjacob 	uint16_t	req_tidlo;
    525       1.50  mjacob 	uint8_t		req_tidhi;
    526       1.50  mjacob 	uint8_t		req_vpidx;
    527       1.50  mjacob 	ispds64_t	req_dataseg;
    528       1.50  mjacob } ispreqt6_t;
    529       1.50  mjacob 
    530       1.50  mjacob typedef struct {
    531       1.50  mjacob 	isphdr_t	req_header;
    532       1.50  mjacob 	uint32_t	req_handle;
    533       1.50  mjacob 	uint16_t	req_nphdl;
    534       1.50  mjacob 	uint16_t	req_time;
    535       1.50  mjacob 	uint16_t	req_seg_count;
    536       1.50  mjacob 	uint16_t	req_reserved;
    537       1.50  mjacob 	uint8_t		req_lun[8];
    538       1.50  mjacob 	uint8_t		req_alen_datadir;
    539       1.50  mjacob 	uint8_t		req_task_management;
    540       1.50  mjacob 	uint8_t		req_task_attribute;
    541       1.50  mjacob 	uint8_t		req_crn;
    542       1.50  mjacob 	uint8_t		req_cdb[16];
    543       1.50  mjacob 	uint32_t	req_dl;
    544       1.50  mjacob 	uint16_t	req_tidlo;
    545       1.50  mjacob 	uint8_t		req_tidhi;
    546       1.50  mjacob 	uint8_t		req_vpidx;
    547       1.50  mjacob 	ispds64_t	req_dataseg;
    548       1.50  mjacob } ispreqt7_t;
    549       1.50  mjacob 
    550       1.51  mjacob /* Task Management Request Function */
    551       1.51  mjacob typedef struct {
    552       1.51  mjacob 	isphdr_t	tmf_header;
    553       1.51  mjacob 	uint32_t	tmf_handle;
    554       1.51  mjacob 	uint16_t	tmf_nphdl;
    555       1.51  mjacob 	uint8_t		tmf_reserved0[2];
    556       1.51  mjacob 	uint16_t	tmf_delay;
    557       1.51  mjacob 	uint16_t	tmf_timeout;
    558       1.51  mjacob 	uint8_t		tmf_lun[8];
    559       1.51  mjacob 	uint32_t	tmf_flags;
    560       1.51  mjacob 	uint8_t		tmf_reserved1[20];
    561       1.51  mjacob 	uint16_t	tmf_tidlo;
    562       1.51  mjacob 	uint8_t		tmf_tidhi;
    563       1.51  mjacob 	uint8_t		tmf_vpidx;
    564       1.51  mjacob 	uint8_t		tmf_reserved2[12];
    565       1.51  mjacob } isp24xx_tmf_t;
    566       1.51  mjacob 
    567       1.51  mjacob #define	ISP24XX_TMF_NOSEND		0x80000000
    568       1.51  mjacob 
    569       1.51  mjacob #define	ISP24XX_TMF_LUN_RESET		0x00000010
    570       1.51  mjacob #define	ISP24XX_TMF_ABORT_TASK_SET	0x00000008
    571       1.51  mjacob #define	ISP24XX_TMF_CLEAR_TASK_SET	0x00000004
    572       1.51  mjacob #define	ISP24XX_TMF_TARGET_RESET	0x00000002
    573       1.51  mjacob #define	ISP24XX_TMF_CLEAR_ACA		0x00000001
    574       1.51  mjacob 
    575       1.50  mjacob /* I/O Abort Structure */
    576       1.50  mjacob typedef struct {
    577       1.50  mjacob 	isphdr_t	abrt_header;
    578       1.50  mjacob 	uint32_t	abrt_handle;
    579       1.50  mjacob 	uint16_t	abrt_nphdl;
    580       1.50  mjacob 	uint16_t	abrt_options;
    581       1.50  mjacob 	uint32_t	abrt_cmd_handle;
    582       1.50  mjacob 	uint8_t		abrt_reserved[32];
    583       1.50  mjacob 	uint16_t	abrt_tidlo;
    584       1.50  mjacob 	uint8_t		abrt_tidhi;
    585       1.50  mjacob 	uint8_t		abrt_vpidx;
    586       1.50  mjacob 	uint8_t		abrt_reserved1[12];
    587       1.50  mjacob } isp24xx_abrt_t;
    588       1.51  mjacob 
    589       1.51  mjacob #define	ISP24XX_ABRT_NOSEND	0x01	/* don't actually send ABTS */
    590       1.51  mjacob #define	ISP24XX_ABRT_OKAY	0x00	/* in nphdl on return */
    591       1.50  mjacob #define	ISP24XX_ABRT_ENXIO	0x31	/* in nphdl on return */
    592       1.50  mjacob 
    593        1.1     cgd #define	ISP_CDSEG	7
    594        1.1     cgd typedef struct {
    595        1.1     cgd 	isphdr_t	req_header;
    596       1.50  mjacob 	uint32_t	req_reserved;
    597        1.1     cgd 	ispds_t		req_dataseg[ISP_CDSEG];
    598        1.1     cgd } ispcontreq_t;
    599        1.1     cgd 
    600       1.34  mjacob #define	ISP_CDSEG64	5
    601       1.34  mjacob typedef struct {
    602       1.34  mjacob 	isphdr_t	req_header;
    603       1.34  mjacob 	ispds64_t	req_dataseg[ISP_CDSEG64];
    604       1.34  mjacob } ispcontreq64_t;
    605       1.34  mjacob 
    606        1.1     cgd typedef struct {
    607        1.1     cgd 	isphdr_t	req_header;
    608       1.50  mjacob 	uint32_t	req_handle;
    609       1.50  mjacob 	uint16_t	req_scsi_status;
    610       1.50  mjacob 	uint16_t	req_completion_status;
    611       1.50  mjacob 	uint16_t	req_state_flags;
    612       1.50  mjacob 	uint16_t	req_status_flags;
    613       1.50  mjacob 	uint16_t	req_time;
    614       1.20  mjacob #define	req_response_len	req_time	/* FC only */
    615       1.50  mjacob 	uint16_t	req_sense_len;
    616       1.50  mjacob 	uint32_t	req_resid;
    617       1.50  mjacob 	uint8_t		req_response[8];	/* FC only */
    618       1.50  mjacob 	uint8_t		req_sense_data[32];
    619        1.1     cgd } ispstatusreq_t;
    620       1.36  mjacob 
    621       1.50  mjacob /*
    622       1.50  mjacob  * Status Continuation
    623       1.50  mjacob  */
    624       1.36  mjacob typedef struct {
    625       1.36  mjacob 	isphdr_t	req_header;
    626       1.50  mjacob 	uint8_t		req_sense_data[60];
    627       1.36  mjacob } ispstatus_cont_t;
    628        1.1     cgd 
    629       1.48   perry /*
    630       1.50  mjacob  * 24XX Type 0 status
    631       1.50  mjacob  */
    632       1.50  mjacob typedef struct {
    633       1.50  mjacob 	isphdr_t	req_header;
    634       1.50  mjacob 	uint32_t	req_handle;
    635       1.50  mjacob 	uint16_t	req_completion_status;
    636       1.50  mjacob 	uint16_t	req_oxid;
    637       1.50  mjacob 	uint32_t	req_resid;
    638       1.50  mjacob 	uint16_t	req_reserved0;
    639       1.50  mjacob 	uint16_t	req_state_flags;
    640       1.50  mjacob 	uint16_t	req_reserved1;
    641       1.50  mjacob 	uint16_t	req_scsi_status;
    642       1.50  mjacob 	uint32_t	req_fcp_residual;
    643       1.50  mjacob 	uint32_t	req_sense_len;
    644       1.50  mjacob 	uint32_t	req_response_len;
    645       1.50  mjacob 	uint8_t		req_rsp_sense[28];
    646       1.50  mjacob } isp24xx_statusreq_t;
    647       1.50  mjacob 
    648       1.50  mjacob /*
    649       1.29  mjacob  * For Qlogic 2X00, the high order byte of SCSI status has
    650        1.3  mjacob  * additional meaning.
    651        1.3  mjacob  */
    652        1.3  mjacob #define	RQCS_RU	0x800	/* Residual Under */
    653        1.3  mjacob #define	RQCS_RO	0x400	/* Residual Over */
    654       1.27  mjacob #define	RQCS_RESID	(RQCS_RU|RQCS_RO)
    655        1.3  mjacob #define	RQCS_SV	0x200	/* Sense Length Valid */
    656       1.27  mjacob #define	RQCS_RV	0x100	/* FCP Response Length Valid */
    657        1.3  mjacob 
    658       1.48   perry /*
    659       1.50  mjacob  * CT Passthru IOCB
    660       1.50  mjacob  */
    661       1.50  mjacob typedef struct {
    662       1.50  mjacob 	isphdr_t	ctp_header;
    663       1.50  mjacob 	uint32_t	ctp_handle;
    664       1.50  mjacob 	uint16_t	ctp_status;
    665       1.50  mjacob 	uint16_t	ctp_nphdl;	/* n-port handle */
    666       1.50  mjacob 	uint16_t	ctp_cmd_cnt;	/* Command DSD count */
    667       1.51  mjacob 	uint8_t		ctp_vpidx;
    668       1.51  mjacob 	uint8_t		ctp_reserved0;
    669       1.50  mjacob 	uint16_t	ctp_time;
    670       1.51  mjacob 	uint16_t	ctp_reserved1;
    671       1.50  mjacob 	uint16_t	ctp_rsp_cnt;	/* Response DSD count */
    672       1.51  mjacob 	uint16_t	ctp_reserved2[5];
    673       1.50  mjacob 	uint32_t	ctp_rsp_bcnt;	/* Response byte count */
    674       1.50  mjacob 	uint32_t	ctp_cmd_bcnt;	/* Command byte count */
    675       1.50  mjacob 	ispds64_t	ctp_dataseg[2];
    676       1.50  mjacob } isp_ct_pt_t;
    677       1.50  mjacob 
    678       1.50  mjacob /*
    679       1.50  mjacob  * MS Passthru IOCB
    680       1.50  mjacob  */
    681       1.50  mjacob typedef struct {
    682       1.50  mjacob 	isphdr_t	ms_header;
    683       1.50  mjacob 	uint32_t	ms_handle;
    684       1.50  mjacob 	uint16_t	ms_nphdl;	/* handle in high byte for !2k f/w */
    685       1.50  mjacob 	uint16_t	ms_status;
    686       1.50  mjacob 	uint16_t	ms_flags;
    687       1.50  mjacob 	uint16_t	ms_reserved1;	/* low 8 bits */
    688       1.50  mjacob 	uint16_t	ms_time;
    689       1.50  mjacob 	uint16_t	ms_cmd_cnt;	/* Command DSD count */
    690       1.50  mjacob 	uint16_t	ms_tot_cnt;	/* Total DSD Count */
    691       1.50  mjacob 	uint8_t		ms_type;	/* MS type */
    692       1.50  mjacob 	uint8_t		ms_r_ctl;	/* R_CTL */
    693       1.50  mjacob 	uint16_t	ms_rxid;	/* RX_ID */
    694       1.50  mjacob 	uint16_t	ms_reserved2;
    695       1.50  mjacob 	uint32_t	ms_handle2;
    696       1.50  mjacob 	uint32_t	ms_rsp_bcnt;	/* Response byte count */
    697       1.50  mjacob 	uint32_t	ms_cmd_bcnt;	/* Command byte count */
    698       1.50  mjacob 	ispds64_t	ms_dataseg[2];
    699       1.50  mjacob } isp_ms_t;
    700       1.50  mjacob 
    701       1.50  mjacob /*
    702        1.3  mjacob  * Completion Status Codes.
    703        1.3  mjacob  */
    704        1.1     cgd #define RQCS_COMPLETE			0x0000
    705        1.1     cgd #define RQCS_DMA_ERROR			0x0002
    706        1.1     cgd #define RQCS_RESET_OCCURRED		0x0004
    707        1.1     cgd #define RQCS_ABORTED			0x0005
    708        1.1     cgd #define RQCS_TIMEOUT			0x0006
    709        1.1     cgd #define RQCS_DATA_OVERRUN		0x0007
    710       1.27  mjacob #define RQCS_DATA_UNDERRUN		0x0015
    711       1.27  mjacob #define	RQCS_QUEUE_FULL			0x001C
    712       1.27  mjacob 
    713       1.27  mjacob /* 1X00 Only Completion Codes */
    714       1.27  mjacob #define RQCS_INCOMPLETE			0x0001
    715       1.27  mjacob #define RQCS_TRANSPORT_ERROR		0x0003
    716        1.1     cgd #define RQCS_COMMAND_OVERRUN		0x0008
    717        1.1     cgd #define RQCS_STATUS_OVERRUN		0x0009
    718        1.1     cgd #define RQCS_BAD_MESSAGE		0x000a
    719        1.1     cgd #define RQCS_NO_MESSAGE_OUT		0x000b
    720        1.1     cgd #define RQCS_EXT_ID_FAILED		0x000c
    721        1.1     cgd #define RQCS_IDE_MSG_FAILED		0x000d
    722        1.1     cgd #define RQCS_ABORT_MSG_FAILED		0x000e
    723        1.1     cgd #define RQCS_REJECT_MSG_FAILED		0x000f
    724        1.1     cgd #define RQCS_NOP_MSG_FAILED		0x0010
    725        1.1     cgd #define RQCS_PARITY_ERROR_MSG_FAILED	0x0011
    726        1.1     cgd #define RQCS_DEVICE_RESET_MSG_FAILED	0x0012
    727        1.1     cgd #define RQCS_ID_MSG_FAILED		0x0013
    728        1.1     cgd #define RQCS_UNEXP_BUS_FREE		0x0014
    729        1.8  mjacob #define	RQCS_XACT_ERR1			0x0018
    730        1.8  mjacob #define	RQCS_XACT_ERR2			0x0019
    731        1.8  mjacob #define	RQCS_XACT_ERR3			0x001A
    732        1.8  mjacob #define	RQCS_BAD_ENTRY			0x001B
    733        1.8  mjacob #define	RQCS_PHASE_SKIPPED		0x001D
    734        1.8  mjacob #define	RQCS_ARQS_FAILED		0x001E
    735        1.8  mjacob #define	RQCS_WIDE_FAILED		0x001F
    736        1.8  mjacob #define	RQCS_SYNCXFER_FAILED		0x0020
    737        1.8  mjacob #define	RQCS_LVD_BUSERR			0x0021
    738        1.8  mjacob 
    739       1.27  mjacob /* 2X00 Only Completion Codes */
    740        1.3  mjacob #define	RQCS_PORT_UNAVAILABLE		0x0028
    741        1.3  mjacob #define	RQCS_PORT_LOGGED_OUT		0x0029
    742        1.3  mjacob #define	RQCS_PORT_CHANGED		0x002A
    743        1.3  mjacob #define	RQCS_PORT_BUSY			0x002B
    744        1.1     cgd 
    745       1.50  mjacob /* 24XX Only Completion Codes */
    746       1.50  mjacob #define	RQCS_24XX_DRE			0x0011	/* data reassembly error */
    747       1.50  mjacob #define	RQCS_24XX_TABORT		0x0013	/* aborted by target */
    748       1.50  mjacob #define	RQCS_24XX_ENOMEM		0x002C	/* f/w resource unavailable */
    749       1.50  mjacob #define	RQCS_24XX_TMO			0x0030	/* task management overrun */
    750       1.50  mjacob 
    751       1.50  mjacob 
    752        1.3  mjacob /*
    753       1.50  mjacob  * 1X00 specific State Flags
    754        1.3  mjacob  */
    755        1.1     cgd #define RQSF_GOT_BUS			0x0100
    756        1.1     cgd #define RQSF_GOT_TARGET			0x0200
    757        1.1     cgd #define RQSF_SENT_CDB			0x0400
    758        1.5  mjacob #define RQSF_XFRD_DATA			0x0800
    759        1.1     cgd #define RQSF_GOT_STATUS			0x1000
    760        1.1     cgd #define RQSF_GOT_SENSE			0x2000
    761        1.5  mjacob #define	RQSF_XFER_COMPLETE		0x4000
    762        1.1     cgd 
    763        1.3  mjacob /*
    764       1.29  mjacob  * 2X00 specific State Flags
    765       1.29  mjacob  * (same as 1X00 except RQSF_GOT_BUS/RQSF_GOT_TARGET are not available)
    766       1.29  mjacob  */
    767       1.29  mjacob #define	RQSF_DATA_IN			0x0020
    768       1.29  mjacob #define	RQSF_DATA_OUT			0x0040
    769       1.29  mjacob #define	RQSF_STAG			0x0008
    770       1.29  mjacob #define	RQSF_OTAG			0x0004
    771       1.29  mjacob #define	RQSF_HTAG			0x0002
    772       1.29  mjacob /*
    773       1.27  mjacob  * 1X00 Status Flags
    774        1.3  mjacob  */
    775        1.1     cgd #define RQSTF_DISCONNECT		0x0001
    776        1.1     cgd #define RQSTF_SYNCHRONOUS		0x0002
    777        1.1     cgd #define RQSTF_PARITY_ERROR		0x0004
    778        1.1     cgd #define RQSTF_BUS_RESET			0x0008
    779        1.1     cgd #define RQSTF_DEVICE_RESET		0x0010
    780        1.1     cgd #define RQSTF_ABORTED			0x0020
    781        1.1     cgd #define RQSTF_TIMEOUT			0x0040
    782        1.1     cgd #define RQSTF_NEGOTIATION		0x0080
    783       1.27  mjacob 
    784       1.27  mjacob /*
    785       1.27  mjacob  * 2X00 specific state flags
    786       1.27  mjacob  */
    787       1.27  mjacob /* RQSF_SENT_CDB	*/
    788       1.27  mjacob /* RQSF_XFRD_DATA	*/
    789       1.27  mjacob /* RQSF_GOT_STATUS	*/
    790       1.27  mjacob /* RQSF_XFER_COMPLETE	*/
    791       1.27  mjacob 
    792       1.27  mjacob /*
    793       1.27  mjacob  * 2X00 specific status flags
    794       1.27  mjacob  */
    795       1.27  mjacob /* RQSTF_ABORTED */
    796       1.27  mjacob /* RQSTF_TIMEOUT */
    797       1.27  mjacob #define	RQSTF_DMA_ERROR			0x0080
    798       1.27  mjacob #define	RQSTF_LOGOUT			0x2000
    799       1.27  mjacob 
    800       1.27  mjacob /*
    801       1.27  mjacob  * Miscellaneous
    802       1.27  mjacob  */
    803       1.27  mjacob #ifndef	ISP_EXEC_THROTTLE
    804       1.27  mjacob #define	ISP_EXEC_THROTTLE	16
    805       1.27  mjacob #endif
    806       1.32  mjacob 
    807       1.32  mjacob /*
    808       1.32  mjacob  * About Firmware returns an 'attribute' word in mailbox 6.
    809       1.50  mjacob  * These attributes are for 2200 and 2300.
    810       1.32  mjacob  */
    811       1.51  mjacob #define	ISP_FW_ATTR_TMODE	0x0001
    812       1.51  mjacob #define	ISP_FW_ATTR_SCCLUN	0x0002
    813       1.51  mjacob #define	ISP_FW_ATTR_FABRIC	0x0004
    814       1.51  mjacob #define	ISP_FW_ATTR_CLASS2	0x0008
    815       1.51  mjacob #define	ISP_FW_ATTR_FCTAPE	0x0010
    816       1.51  mjacob #define	ISP_FW_ATTR_IP		0x0020
    817       1.51  mjacob #define	ISP_FW_ATTR_VI		0x0040
    818       1.51  mjacob #define	ISP_FW_ATTR_VI_SOLARIS	0x0080
    819       1.51  mjacob #define	ISP_FW_ATTR_2KLOGINS	0x0100	/* just a guess... */
    820       1.50  mjacob 
    821       1.50  mjacob /* and these are for the 2400 */
    822       1.51  mjacob #define	ISP2400_FW_ATTR_CLASS2	0x0001
    823       1.51  mjacob #define	ISP2400_FW_ATTR_IP	0x0002
    824       1.51  mjacob #define	ISP2400_FW_ATTR_MULTIID	0x0004
    825       1.51  mjacob #define	ISP2400_FW_ATTR_SB2	0x0008
    826       1.51  mjacob #define	ISP2400_FW_ATTR_T10CRC	0x0010
    827       1.51  mjacob #define	ISP2400_FW_ATTR_VI	0x0020
    828       1.51  mjacob #define	ISP2400_FW_ATTR_EXPFW	0x2000
    829       1.51  mjacob 
    830       1.51  mjacob #define	ISP_CAP_TMODE(isp)	\
    831       1.51  mjacob 	(IS_24XX(isp)? 1 : (isp->isp_fwattr & ISP_FW_ATTR_TMODE))
    832       1.51  mjacob #define	ISP_CAP_SCCFW(isp)	\
    833       1.51  mjacob 	(IS_24XX(isp)? 1 : (isp->isp_fwattr & ISP_FW_ATTR_SCCLUN))
    834       1.51  mjacob #define	ISP_CAP_2KLOGIN(isp)	\
    835       1.51  mjacob 	(IS_24XX(isp)? 1 : (isp->isp_fwattr & ISP_FW_ATTR_2KLOGINS))
    836       1.51  mjacob #define	ISP_CAP_MULTI_ID(isp)	\
    837       1.51  mjacob 	(IS_24XX(isp)? (isp->isp_fwattr & ISP2400_FW_ATTR_MULTIID) : 0)
    838       1.33  mjacob 
    839  1.52.12.1     jym #define	ISP_GET_VPIDX(isp, tag) \
    840  1.52.12.1     jym 	(ISP_CAP_MULTI_ID(isp) ? tag : 0)
    841  1.52.12.1     jym 
    842       1.33  mjacob /*
    843       1.33  mjacob  * Reduced Interrupt Operation Response Queue Entreis
    844       1.33  mjacob  */
    845       1.33  mjacob 
    846       1.33  mjacob typedef struct {
    847       1.33  mjacob 	isphdr_t	req_header;
    848       1.50  mjacob 	uint32_t	req_handles[15];
    849       1.33  mjacob } isp_rio1_t;
    850       1.33  mjacob 
    851       1.33  mjacob typedef struct {
    852       1.33  mjacob 	isphdr_t	req_header;
    853       1.50  mjacob 	uint16_t	req_handles[30];
    854       1.33  mjacob } isp_rio2_t;
    855        1.3  mjacob 
    856        1.3  mjacob /*
    857       1.50  mjacob  * FC (ISP2100/ISP2200/ISP2300/ISP2400) specific data structures
    858        1.3  mjacob  */
    859        1.3  mjacob 
    860        1.3  mjacob /*
    861        1.3  mjacob  * Initialization Control Block
    862        1.8  mjacob  *
    863       1.19  mjacob  * Version One (prime) format.
    864        1.3  mjacob  */
    865       1.50  mjacob typedef struct {
    866       1.50  mjacob 	uint8_t		icb_version;
    867       1.50  mjacob 	uint8_t		icb_reserved0;
    868       1.50  mjacob 	uint16_t	icb_fwoptions;
    869       1.50  mjacob 	uint16_t	icb_maxfrmlen;
    870       1.50  mjacob 	uint16_t	icb_maxalloc;
    871       1.50  mjacob 	uint16_t	icb_execthrottle;
    872       1.50  mjacob 	uint8_t		icb_retry_count;
    873       1.50  mjacob 	uint8_t		icb_retry_delay;
    874       1.50  mjacob 	uint8_t		icb_portname[8];
    875       1.50  mjacob 	uint16_t	icb_hardaddr;
    876       1.50  mjacob 	uint8_t		icb_iqdevtype;
    877       1.50  mjacob 	uint8_t		icb_logintime;
    878       1.50  mjacob 	uint8_t		icb_nodename[8];
    879       1.50  mjacob 	uint16_t	icb_rqstout;
    880       1.50  mjacob 	uint16_t	icb_rspnsin;
    881       1.50  mjacob 	uint16_t	icb_rqstqlen;
    882       1.50  mjacob 	uint16_t	icb_rsltqlen;
    883       1.50  mjacob 	uint16_t	icb_rqstaddr[4];
    884       1.50  mjacob 	uint16_t	icb_respaddr[4];
    885       1.50  mjacob 	uint16_t	icb_lunenables;
    886       1.50  mjacob 	uint8_t		icb_ccnt;
    887       1.50  mjacob 	uint8_t		icb_icnt;
    888       1.50  mjacob 	uint16_t	icb_lunetimeout;
    889       1.50  mjacob 	uint16_t	icb_reserved1;
    890       1.50  mjacob 	uint16_t	icb_xfwoptions;
    891       1.50  mjacob 	uint8_t		icb_racctimer;
    892       1.50  mjacob 	uint8_t		icb_idelaytimer;
    893       1.50  mjacob 	uint16_t	icb_zfwoptions;
    894       1.50  mjacob 	uint16_t	icb_reserved2[13];
    895        1.3  mjacob } isp_icb_t;
    896       1.50  mjacob 
    897        1.8  mjacob #define	ICB_VERSION1	1
    898        1.8  mjacob 
    899       1.50  mjacob #define	ICBOPT_EXTENDED		0x8000
    900       1.50  mjacob #define	ICBOPT_BOTH_WWNS	0x4000
    901       1.50  mjacob #define	ICBOPT_FULL_LOGIN	0x2000
    902       1.50  mjacob #define	ICBOPT_STOP_ON_QFULL	0x1000	/* 2200/2100 only */
    903       1.50  mjacob #define	ICBOPT_PREVLOOP		0x0800
    904       1.50  mjacob #define	ICBOPT_SRCHDOWN		0x0400
    905       1.50  mjacob #define	ICBOPT_NOLIP		0x0200
    906       1.50  mjacob #define	ICBOPT_PDBCHANGE_AE	0x0100
    907       1.50  mjacob #define	ICBOPT_INI_TGTTYPE	0x0080
    908       1.50  mjacob #define	ICBOPT_INI_ADISC	0x0040
    909       1.50  mjacob #define	ICBOPT_INI_DISABLE	0x0020
    910       1.50  mjacob #define	ICBOPT_TGT_ENABLE	0x0010
    911       1.50  mjacob #define	ICBOPT_FAST_POST	0x0008
    912       1.50  mjacob #define	ICBOPT_FULL_DUPLEX	0x0004
    913       1.50  mjacob #define	ICBOPT_FAIRNESS		0x0002
    914       1.18  mjacob #define	ICBOPT_HARD_ADDRESS	0x0001
    915       1.21  mjacob 
    916       1.50  mjacob #define	ICBXOPT_NO_LOGOUT	0x8000	/* no logout on link failure */
    917       1.50  mjacob #define	ICBXOPT_FCTAPE_CCQ	0x4000	/* FC-Tape Command Queueing */
    918       1.50  mjacob #define	ICBXOPT_FCTAPE_CONFIRM	0x2000
    919       1.50  mjacob #define	ICBXOPT_FCTAPE		0x1000
    920       1.21  mjacob #define	ICBXOPT_CLASS2_ACK0	0x0200
    921       1.21  mjacob #define	ICBXOPT_CLASS2		0x0100
    922       1.50  mjacob #define	ICBXOPT_NO_PLAY		0x0080	/* don't play if can't get hard addr */
    923       1.50  mjacob #define	ICBXOPT_TOPO_MASK	0x0070
    924       1.50  mjacob #define	ICBXOPT_LOOP_ONLY	0x0000
    925       1.50  mjacob #define	ICBXOPT_PTP_ONLY	0x0010
    926       1.50  mjacob #define	ICBXOPT_LOOP_2_PTP	0x0020
    927       1.50  mjacob #define	ICBXOPT_PTP_2_LOOP	0x0030
    928       1.46  mjacob /*
    929       1.46  mjacob  * The lower 4 bits of the xfwoptions field are the OPERATION MODE bits.
    930       1.50  mjacob  * RIO is not defined for the 23XX cards (just 2200)
    931       1.46  mjacob  */
    932       1.21  mjacob #define	ICBXOPT_RIO_OFF		0
    933       1.21  mjacob #define	ICBXOPT_RIO_16BIT	1
    934       1.21  mjacob #define	ICBXOPT_RIO_32BIT	2
    935       1.37  mjacob #define	ICBXOPT_RIO_16BIT_IOCB	3
    936       1.37  mjacob #define	ICBXOPT_RIO_32BIT_IOCB	4
    937       1.50  mjacob #define	ICBXOPT_ZIO		5
    938       1.50  mjacob #define	ICBXOPT_TIMER_MASK	0x7
    939        1.8  mjacob 
    940       1.50  mjacob #define	ICBZOPT_RATE_MASK	0xC000
    941       1.50  mjacob #define	ICBZOPT_RATE_ONEGB	0x0000
    942       1.50  mjacob #define	ICBZOPT_RATE_AUTO	0x8000
    943       1.50  mjacob #define	ICBZOPT_RATE_TWOGB	0x4000
    944       1.50  mjacob #define	ICBZOPT_50_OHM		0x2000
    945       1.50  mjacob #define	ICBZOPT_ENA_OOF		0x0040	/* out of order frame handling */
    946       1.50  mjacob #define	ICBZOPT_RSPSZ_MASK	0x0030
    947       1.50  mjacob #define	ICBZOPT_RSPSZ_24	0x0000
    948       1.50  mjacob #define	ICBZOPT_RSPSZ_12	0x0010
    949       1.50  mjacob #define	ICBZOPT_RSPSZ_24A	0x0020
    950       1.50  mjacob #define	ICBZOPT_RSPSZ_32	0x0030
    951       1.50  mjacob #define	ICBZOPT_SOFTID		0x0002
    952       1.50  mjacob #define	ICBZOPT_ENA_RDXFR_RDY	0x0001
    953       1.50  mjacob 
    954       1.50  mjacob /* 2400 F/W options */
    955       1.50  mjacob #define	ICB2400_OPT1_BOTH_WWNS		0x00004000
    956       1.50  mjacob #define	ICB2400_OPT1_FULL_LOGIN		0x00002000
    957       1.50  mjacob #define	ICB2400_OPT1_PREVLOOP		0x00000800
    958       1.50  mjacob #define	ICB2400_OPT1_SRCHDOWN		0x00000400
    959       1.50  mjacob #define	ICB2400_OPT1_NOLIP		0x00000200
    960       1.50  mjacob #define	ICB2400_OPT1_INI_DISABLE	0x00000020
    961       1.50  mjacob #define	ICB2400_OPT1_TGT_ENABLE		0x00000010
    962       1.50  mjacob #define	ICB2400_OPT1_FULL_DUPLEX	0x00000004
    963       1.50  mjacob #define	ICB2400_OPT1_FAIRNESS		0x00000002
    964       1.50  mjacob #define	ICB2400_OPT1_HARD_ADDRESS	0x00000001
    965       1.50  mjacob 
    966       1.50  mjacob #define	ICB2400_OPT2_FCTAPE		0x00001000
    967       1.50  mjacob #define	ICB2400_OPT2_CLASS2_ACK0	0x00000200
    968       1.50  mjacob #define	ICB2400_OPT2_CLASS2		0x00000100
    969       1.50  mjacob #define	ICB2400_OPT2_NO_PLAY		0x00000080
    970       1.50  mjacob #define	ICB2400_OPT2_TOPO_MASK		0x00000070
    971       1.50  mjacob #define	ICB2400_OPT2_LOOP_ONLY		0x00000000
    972       1.50  mjacob #define	ICB2400_OPT2_PTP_ONLY		0x00000010
    973       1.50  mjacob #define	ICB2400_OPT2_LOOP_2_PTP		0x00000020
    974       1.50  mjacob #define	ICB2400_OPT2_PTP_2_LOOP		0x00000030
    975       1.50  mjacob #define	ICB2400_OPT2_TIMER_MASK		0x00000007
    976       1.50  mjacob #define	ICB2400_OPT2_ZIO		0x00000005
    977       1.50  mjacob #define	ICB2400_OPT2_ZIO1		0x00000006
    978       1.50  mjacob 
    979       1.50  mjacob #define	ICB2400_OPT3_75_OHM		0x00010000
    980       1.50  mjacob #define	ICB2400_OPT3_RATE_MASK		0x0000E000
    981       1.50  mjacob #define	ICB2400_OPT3_RATE_ONEGB		0x00000000
    982       1.50  mjacob #define	ICB2400_OPT3_RATE_TWOGB		0x00002000
    983       1.50  mjacob #define ICB2400_OPT3_RATE_AUTO		0x00004000
    984       1.50  mjacob #define	ICB2400_OPT3_RATE_FOURGB	0x00006000
    985  1.52.12.1     jym #define	ICB2400_OPT3_RATE_EIGHTGB	0x00008000
    986       1.50  mjacob #define	ICB2400_OPT3_ENA_OOF_XFRDY	0x00000200
    987       1.50  mjacob #define	ICB2400_OPT3_NO_LOCAL_PLOGI	0x00000080
    988       1.50  mjacob #define	ICB2400_OPT3_ENA_OOF		0x00000040
    989       1.50  mjacob /* note that a response size flag of zero is reserved! */
    990       1.50  mjacob #define	ICB2400_OPT3_RSPSZ_MASK		0x00000030
    991       1.50  mjacob #define	ICB2400_OPT3_RSPSZ_12		0x00000010
    992       1.50  mjacob #define	ICB2400_OPT3_RSPSZ_24		0x00000020
    993       1.50  mjacob #define	ICB2400_OPT3_RSPSZ_32		0x00000030
    994       1.50  mjacob #define	ICB2400_OPT3_SOFTID		0x00000002
    995        1.8  mjacob 
    996        1.8  mjacob #define	ICB_MIN_FRMLEN		256
    997        1.8  mjacob #define	ICB_MAX_FRMLEN		2112
    998        1.8  mjacob #define	ICB_DFLT_FRMLEN		1024
    999       1.18  mjacob #define	ICB_DFLT_ALLOC		256
   1000       1.18  mjacob #define	ICB_DFLT_THROTTLE	16
   1001       1.18  mjacob #define	ICB_DFLT_RDELAY		5
   1002       1.18  mjacob #define	ICB_DFLT_RCOUNT		3
   1003       1.18  mjacob 
   1004       1.50  mjacob #define	ICB_LOGIN_TOV		30
   1005       1.50  mjacob #define	ICB_LUN_ENABLE_TOV	180
   1006       1.50  mjacob 
   1007       1.50  mjacob 
   1008       1.50  mjacob /*
   1009       1.50  mjacob  * And somebody at QLogic had a great idea that you could just change
   1010       1.50  mjacob  * the structure *and* keep the version number the same as the other cards.
   1011       1.50  mjacob  */
   1012       1.50  mjacob typedef struct {
   1013       1.50  mjacob 	uint16_t	icb_version;
   1014       1.50  mjacob 	uint16_t	icb_reserved0;
   1015       1.50  mjacob 	uint16_t	icb_maxfrmlen;
   1016       1.50  mjacob 	uint16_t	icb_execthrottle;
   1017       1.50  mjacob 	uint16_t	icb_xchgcnt;
   1018       1.50  mjacob 	uint16_t	icb_hardaddr;
   1019       1.50  mjacob 	uint8_t		icb_portname[8];
   1020       1.50  mjacob 	uint8_t		icb_nodename[8];
   1021       1.50  mjacob 	uint16_t	icb_rspnsin;
   1022       1.50  mjacob 	uint16_t	icb_rqstout;
   1023       1.50  mjacob 	uint16_t	icb_retry_count;
   1024       1.50  mjacob 	uint16_t	icb_priout;
   1025       1.50  mjacob 	uint16_t	icb_rsltqlen;
   1026       1.50  mjacob 	uint16_t	icb_rqstqlen;
   1027       1.50  mjacob 	uint16_t	icb_ldn_nols;
   1028       1.50  mjacob 	uint16_t	icb_prqstqlen;
   1029       1.50  mjacob 	uint16_t	icb_rqstaddr[4];
   1030       1.50  mjacob 	uint16_t	icb_respaddr[4];
   1031       1.50  mjacob 	uint16_t	icb_priaddr[4];
   1032       1.50  mjacob 	uint16_t	icb_reserved1[4];
   1033       1.50  mjacob 	uint16_t	icb_atio_in;
   1034       1.50  mjacob 	uint16_t	icb_atioqlen;
   1035       1.50  mjacob 	uint16_t	icb_atioqaddr[4];
   1036       1.50  mjacob 	uint16_t	icb_idelaytimer;
   1037       1.50  mjacob 	uint16_t	icb_logintime;
   1038       1.50  mjacob 	uint32_t	icb_fwoptions1;
   1039       1.50  mjacob 	uint32_t	icb_fwoptions2;
   1040       1.50  mjacob 	uint32_t	icb_fwoptions3;
   1041       1.50  mjacob 	uint16_t	icb_reserved2[12];
   1042       1.50  mjacob } isp_icb_2400_t;
   1043        1.8  mjacob 
   1044        1.8  mjacob #define	RQRSP_ADDR0015	0
   1045        1.8  mjacob #define	RQRSP_ADDR1631	1
   1046        1.8  mjacob #define	RQRSP_ADDR3247	2
   1047        1.8  mjacob #define	RQRSP_ADDR4863	3
   1048        1.8  mjacob 
   1049        1.8  mjacob 
   1050        1.8  mjacob #define	ICB_NNM0	7
   1051        1.8  mjacob #define	ICB_NNM1	6
   1052        1.8  mjacob #define	ICB_NNM2	5
   1053        1.8  mjacob #define	ICB_NNM3	4
   1054        1.8  mjacob #define	ICB_NNM4	3
   1055        1.8  mjacob #define	ICB_NNM5	2
   1056        1.8  mjacob #define	ICB_NNM6	1
   1057        1.8  mjacob #define	ICB_NNM7	0
   1058        1.3  mjacob 
   1059        1.8  mjacob #define	MAKE_NODE_NAME_FROM_WWN(array, wwn)	\
   1060       1.50  mjacob 	array[ICB_NNM0] = (uint8_t) ((wwn >>  0) & 0xff), \
   1061       1.50  mjacob 	array[ICB_NNM1] = (uint8_t) ((wwn >>  8) & 0xff), \
   1062       1.50  mjacob 	array[ICB_NNM2] = (uint8_t) ((wwn >> 16) & 0xff), \
   1063       1.50  mjacob 	array[ICB_NNM3] = (uint8_t) ((wwn >> 24) & 0xff), \
   1064       1.50  mjacob 	array[ICB_NNM4] = (uint8_t) ((wwn >> 32) & 0xff), \
   1065       1.50  mjacob 	array[ICB_NNM5] = (uint8_t) ((wwn >> 40) & 0xff), \
   1066       1.50  mjacob 	array[ICB_NNM6] = (uint8_t) ((wwn >> 48) & 0xff), \
   1067       1.50  mjacob 	array[ICB_NNM7] = (uint8_t) ((wwn >> 56) & 0xff)
   1068       1.50  mjacob 
   1069       1.50  mjacob #define	MAKE_WWN_FROM_NODE_NAME(wwn, array)	\
   1070       1.50  mjacob 	wwn =	((uint64_t) array[ICB_NNM0]) | \
   1071       1.50  mjacob 		((uint64_t) array[ICB_NNM1] <<  8) | \
   1072       1.50  mjacob 		((uint64_t) array[ICB_NNM2] << 16) | \
   1073       1.50  mjacob 		((uint64_t) array[ICB_NNM3] << 24) | \
   1074       1.50  mjacob 		((uint64_t) array[ICB_NNM4] << 32) | \
   1075       1.50  mjacob 		((uint64_t) array[ICB_NNM5] << 40) | \
   1076       1.50  mjacob 		((uint64_t) array[ICB_NNM6] << 48) | \
   1077       1.50  mjacob 		((uint64_t) array[ICB_NNM7] << 56)
   1078       1.14  mjacob 
   1079       1.51  mjacob 
   1080       1.51  mjacob /*
   1081       1.51  mjacob  * For MULTI_ID firmware, this describes a
   1082       1.51  mjacob  * virtual port entity for getting status.
   1083       1.51  mjacob  */
   1084       1.51  mjacob typedef struct {
   1085       1.51  mjacob 	uint16_t	vp_port_status;
   1086       1.51  mjacob 	uint8_t		vp_port_options;
   1087       1.51  mjacob 	uint8_t		vp_port_loopid;
   1088       1.51  mjacob 	uint8_t		vp_port_portname[8];
   1089       1.51  mjacob 	uint8_t		vp_port_nodename[8];
   1090       1.51  mjacob 	uint16_t	vp_port_portid_lo;	/* not present when trailing icb */
   1091       1.51  mjacob 	uint16_t	vp_port_portid_hi;	/* not present when trailing icb */
   1092       1.51  mjacob } vp_port_info_t;
   1093       1.51  mjacob 
   1094       1.51  mjacob #define	ICB2400_VPOPT_TGT_DISABLE	0x00000020	/* disable target mode */
   1095       1.51  mjacob #define	ICB2400_VPOPT_INI_ENABLE	0x00000010	/* enable initiator mode */
   1096       1.51  mjacob #define	ICB2400_VPOPT_ENABLED		0x00000008
   1097       1.51  mjacob #define	ICB2400_VPOPT_NOPLAY		0x00000004
   1098       1.51  mjacob #define	ICB2400_VPOPT_PREVLOOP		0x00000002
   1099       1.51  mjacob #define	ICB2400_VPOPT_HARD_ADDRESS	0x00000001
   1100       1.51  mjacob 
   1101       1.51  mjacob #define	ICB2400_VPOPT_WRITE_SIZE	20
   1102       1.51  mjacob 
   1103       1.51  mjacob /*
   1104       1.51  mjacob  * For MULTI_ID firmware, we append this structure
   1105       1.51  mjacob  * to the isp_icb_2400_t above, followed by a list
   1106       1.51  mjacob  * structures that are *most* of the vp_port_info_t.
   1107       1.51  mjacob  */
   1108       1.51  mjacob typedef struct {
   1109       1.51  mjacob 	uint16_t	vp_count;
   1110       1.51  mjacob 	uint16_t	vp_global_options;
   1111       1.51  mjacob } isp_icb_2400_vpinfo_t;
   1112       1.51  mjacob 
   1113       1.51  mjacob #define	ICB2400_VPINFO_OFF	0x80	/* offset from start of ICB */
   1114       1.51  mjacob #define	ICB2400_VPINFO_PORT_OFF(chan)		\
   1115       1.51  mjacob     ICB2400_VPINFO_OFF + 			\
   1116       1.51  mjacob     sizeof (isp_icb_2400_vpinfo_t) + ((chan - 1) * ICB2400_VPOPT_WRITE_SIZE)
   1117       1.51  mjacob 
   1118       1.51  mjacob #define	ICB2400_VPGOPT_MID_DISABLE	0x02
   1119       1.51  mjacob 
   1120       1.51  mjacob typedef struct {
   1121       1.51  mjacob 	isphdr_t	vp_ctrl_hdr;
   1122       1.51  mjacob 	uint32_t	vp_ctrl_handle;
   1123       1.51  mjacob 	uint16_t	vp_ctrl_index_fail;
   1124       1.51  mjacob 	uint16_t	vp_ctrl_status;
   1125       1.51  mjacob 	uint16_t	vp_ctrl_command;
   1126       1.51  mjacob 	uint16_t	vp_ctrl_vp_count;
   1127       1.51  mjacob 	uint16_t	vp_ctrl_idmap[8];
   1128       1.51  mjacob 	uint8_t		vp_ctrl_reserved[32];
   1129       1.51  mjacob } vp_ctrl_info_t;
   1130       1.51  mjacob 
   1131       1.51  mjacob #define	VP_CTRL_CMD_ENABLE_VP			0
   1132       1.51  mjacob #define	VP_CTRL_CMD_DISABLE_VP			8
   1133       1.51  mjacob #define	VP_CTRL_CMD_DISABLE_VP_REINIT_LINK	9
   1134       1.51  mjacob #define	VP_CTRL_CMD_DISABLE_VP_LOGO		0xA
   1135       1.51  mjacob 
   1136       1.51  mjacob /*
   1137       1.51  mjacob  * We can use this structure for modifying either one or two VP ports after initialization
   1138       1.51  mjacob  */
   1139       1.51  mjacob typedef struct {
   1140       1.51  mjacob 	isphdr_t	vp_mod_hdr;
   1141       1.51  mjacob 	uint32_t	vp_mod_hdl;
   1142       1.51  mjacob 	uint16_t	vp_mod_reserved0;
   1143       1.51  mjacob 	uint16_t	vp_mod_status;
   1144       1.51  mjacob 	uint8_t		vp_mod_cmd;
   1145       1.51  mjacob 	uint8_t		vp_mod_cnt;
   1146       1.51  mjacob 	uint8_t		vp_mod_idx0;
   1147       1.51  mjacob 	uint8_t		vp_mod_idx1;
   1148       1.51  mjacob 	struct {
   1149       1.51  mjacob 		uint8_t		options;
   1150       1.51  mjacob 		uint8_t		loopid;
   1151       1.51  mjacob 		uint16_t	reserved1;
   1152       1.51  mjacob 		uint8_t		wwpn[8];
   1153       1.51  mjacob 		uint8_t		wwnn[8];
   1154       1.51  mjacob 	} vp_mod_ports[2];
   1155       1.51  mjacob 	uint8_t		vp_mod_reserved2[8];
   1156       1.51  mjacob } vp_modify_t;
   1157       1.51  mjacob 
   1158       1.51  mjacob #define	VP_STS_OK	0x00
   1159       1.51  mjacob #define	VP_STS_ERR	0x01
   1160       1.51  mjacob #define	VP_CNT_ERR	0x02
   1161       1.51  mjacob #define	VP_GEN_ERR	0x03
   1162       1.51  mjacob #define	VP_IDX_ERR	0x04
   1163       1.51  mjacob #define	VP_STS_BSY	0x05
   1164       1.51  mjacob 
   1165       1.51  mjacob #define	VP_MODIFY_VP	0x00
   1166       1.51  mjacob #define	VP_MODIFY_ENA	0x01
   1167       1.51  mjacob 
   1168       1.14  mjacob /*
   1169       1.14  mjacob  * Port Data Base Element
   1170       1.14  mjacob  */
   1171       1.14  mjacob 
   1172       1.14  mjacob typedef struct {
   1173       1.50  mjacob 	uint16_t	pdb_options;
   1174       1.50  mjacob 	uint8_t		pdb_mstate;
   1175       1.50  mjacob 	uint8_t		pdb_sstate;
   1176       1.50  mjacob 	uint8_t		pdb_hardaddr_bits[4];
   1177       1.50  mjacob 	uint8_t		pdb_portid_bits[4];
   1178       1.50  mjacob 	uint8_t		pdb_nodename[8];
   1179       1.50  mjacob 	uint8_t		pdb_portname[8];
   1180       1.50  mjacob 	uint16_t	pdb_execthrottle;
   1181       1.50  mjacob 	uint16_t	pdb_exec_count;
   1182       1.50  mjacob 	uint8_t		pdb_retry_count;
   1183       1.50  mjacob 	uint8_t		pdb_retry_delay;
   1184       1.50  mjacob 	uint16_t	pdb_resalloc;
   1185       1.50  mjacob 	uint16_t	pdb_curalloc;
   1186       1.50  mjacob 	uint16_t	pdb_qhead;
   1187       1.50  mjacob 	uint16_t	pdb_qtail;
   1188       1.50  mjacob 	uint16_t	pdb_tl_next;
   1189       1.50  mjacob 	uint16_t	pdb_tl_last;
   1190       1.50  mjacob 	uint16_t	pdb_features;	/* PLOGI, Common Service */
   1191       1.50  mjacob 	uint16_t	pdb_pconcurrnt;	/* PLOGI, Common Service */
   1192       1.50  mjacob 	uint16_t	pdb_roi;	/* PLOGI, Common Service */
   1193       1.50  mjacob 	uint8_t		pdb_target;
   1194       1.50  mjacob 	uint8_t		pdb_initiator;	/* PLOGI, Class 3 Control Flags */
   1195       1.50  mjacob 	uint16_t	pdb_rdsiz;	/* PLOGI, Class 3 */
   1196       1.50  mjacob 	uint16_t	pdb_ncseq;	/* PLOGI, Class 3 */
   1197       1.50  mjacob 	uint16_t	pdb_noseq;	/* PLOGI, Class 3 */
   1198       1.50  mjacob 	uint16_t	pdb_labrtflg;
   1199       1.50  mjacob 	uint16_t	pdb_lstopflg;
   1200       1.50  mjacob 	uint16_t	pdb_sqhead;
   1201       1.50  mjacob 	uint16_t	pdb_sqtail;
   1202       1.50  mjacob 	uint16_t	pdb_ptimer;
   1203       1.50  mjacob 	uint16_t	pdb_nxt_seqid;
   1204       1.50  mjacob 	uint16_t	pdb_fcount;
   1205       1.50  mjacob 	uint16_t	pdb_prli_len;
   1206       1.50  mjacob 	uint16_t	pdb_prli_svc0;
   1207       1.50  mjacob 	uint16_t	pdb_prli_svc3;
   1208       1.50  mjacob 	uint16_t	pdb_loopid;
   1209       1.50  mjacob 	uint16_t	pdb_il_ptr;
   1210       1.50  mjacob 	uint16_t	pdb_sl_ptr;
   1211       1.50  mjacob } isp_pdb_21xx_t;
   1212       1.14  mjacob 
   1213       1.14  mjacob #define	PDB_OPTIONS_XMITTING	(1<<11)
   1214       1.14  mjacob #define	PDB_OPTIONS_LNKXMIT	(1<<10)
   1215       1.14  mjacob #define	PDB_OPTIONS_ABORTED	(1<<9)
   1216       1.14  mjacob #define	PDB_OPTIONS_ADISC	(1<<1)
   1217       1.14  mjacob 
   1218       1.14  mjacob #define	PDB_STATE_DISCOVERY	0
   1219       1.14  mjacob #define	PDB_STATE_WDISC_ACK	1
   1220       1.14  mjacob #define	PDB_STATE_PLOGI		2
   1221       1.14  mjacob #define	PDB_STATE_PLOGI_ACK	3
   1222       1.14  mjacob #define	PDB_STATE_PRLI		4
   1223       1.14  mjacob #define	PDB_STATE_PRLI_ACK	5
   1224       1.14  mjacob #define	PDB_STATE_LOGGED_IN	6
   1225       1.14  mjacob #define	PDB_STATE_PORT_UNAVAIL	7
   1226       1.14  mjacob #define	PDB_STATE_PRLO		8
   1227       1.14  mjacob #define	PDB_STATE_PRLO_ACK	9
   1228       1.14  mjacob #define	PDB_STATE_PLOGO		10
   1229       1.14  mjacob #define	PDB_STATE_PLOG_ACK	11
   1230       1.14  mjacob 
   1231       1.14  mjacob #define		SVC3_TGT_ROLE		0x10
   1232       1.14  mjacob #define 	SVC3_INI_ROLE		0x20
   1233       1.14  mjacob #define			SVC3_ROLE_MASK	0x30
   1234       1.18  mjacob #define			SVC3_ROLE_SHIFT	4
   1235       1.18  mjacob 
   1236       1.50  mjacob #define	BITS2WORD(x)		((x)[0] << 16 | (x)[3] << 8 | (x)[2])
   1237       1.50  mjacob #define	BITS2WORD_24XX(x)	((x)[0] << 16 | (x)[1] << 8 | (x)[2])
   1238       1.50  mjacob 
   1239       1.50  mjacob /*
   1240       1.50  mjacob  * Port Data Base Element- 24XX cards
   1241       1.50  mjacob  */
   1242       1.50  mjacob typedef struct {
   1243       1.50  mjacob 	uint16_t	pdb_flags;
   1244       1.50  mjacob 	uint8_t		pdb_curstate;
   1245       1.50  mjacob 	uint8_t		pdb_laststate;
   1246       1.50  mjacob 	uint8_t		pdb_hardaddr_bits[4];
   1247       1.50  mjacob 	uint8_t		pdb_portid_bits[4];
   1248       1.50  mjacob #define		pdb_nxt_seqid_2400	pdb_portid_bits[3]
   1249       1.50  mjacob 	uint16_t	pdb_retry_timer;
   1250       1.50  mjacob 	uint16_t	pdb_handle;
   1251       1.50  mjacob 	uint16_t	pdb_rcv_dsize;
   1252       1.50  mjacob 	uint16_t	pdb_reserved0;
   1253       1.50  mjacob 	uint16_t	pdb_prli_svc0;
   1254       1.50  mjacob 	uint16_t	pdb_prli_svc3;
   1255       1.50  mjacob 	uint8_t		pdb_portname[8];
   1256       1.50  mjacob 	uint8_t		pdb_nodename[8];
   1257       1.50  mjacob 	uint8_t		pdb_reserved1[24];
   1258       1.50  mjacob } isp_pdb_24xx_t;
   1259       1.50  mjacob 
   1260       1.50  mjacob #define	PDB2400_TID_SUPPORTED	0x4000
   1261       1.50  mjacob #define	PDB2400_FC_TAPE		0x0080
   1262       1.50  mjacob #define	PDB2400_CLASS2_ACK0	0x0040
   1263       1.50  mjacob #define	PDB2400_FCP_CONF	0x0020
   1264       1.50  mjacob #define	PDB2400_CLASS2		0x0010
   1265       1.50  mjacob #define	PDB2400_ADDR_VALID	0x0002
   1266       1.50  mjacob 
   1267       1.51  mjacob #define	PDB2400_STATE_PLOGI_PEND	0x03
   1268       1.51  mjacob #define	PDB2400_STATE_PLOGI_DONE	0x04
   1269       1.51  mjacob #define	PDB2400_STATE_PRLI_PEND		0x05
   1270       1.51  mjacob #define	PDB2400_STATE_LOGGED_IN		0x06
   1271       1.51  mjacob #define	PDB2400_STATE_PORT_UNAVAIL	0x07
   1272       1.51  mjacob #define	PDB2400_STATE_PRLO_PEND		0x09
   1273       1.51  mjacob #define	PDB2400_STATE_LOGO_PEND		0x0B
   1274       1.51  mjacob 
   1275       1.50  mjacob /*
   1276       1.50  mjacob  * Common elements from the above two structures that are actually useful to us.
   1277       1.50  mjacob  */
   1278       1.50  mjacob typedef struct {
   1279       1.50  mjacob 	uint16_t	handle;
   1280       1.50  mjacob 	uint16_t	reserved;
   1281       1.50  mjacob 	uint32_t	s3_role	: 8,
   1282       1.50  mjacob 			portid	: 24;
   1283       1.50  mjacob 	uint8_t		portname[8];
   1284       1.50  mjacob 	uint8_t		nodename[8];
   1285       1.50  mjacob } isp_pdb_t;
   1286       1.50  mjacob 
   1287       1.39  mjacob /*
   1288       1.51  mjacob  * Port Database Changed Async Event information for 24XX cards
   1289       1.51  mjacob  */
   1290       1.51  mjacob #define	PDB24XX_AE_OK		0x00
   1291       1.51  mjacob #define	PDB24XX_AE_IMPL_LOGO_1	0x01
   1292       1.51  mjacob #define	PDB24XX_AE_IMPL_LOGO_2	0x02
   1293       1.51  mjacob #define	PDB24XX_AE_IMPL_LOGO_3	0x03
   1294       1.51  mjacob #define	PDB24XX_AE_PLOGI_RCVD	0x04
   1295       1.51  mjacob #define	PDB24XX_AE_PLOGI_RJT	0x05
   1296       1.51  mjacob #define	PDB24XX_AE_PRLI_RCVD	0x06
   1297       1.51  mjacob #define	PDB24XX_AE_PRLI_RJT	0x07
   1298       1.51  mjacob #define	PDB24XX_AE_TPRLO	0x08
   1299       1.51  mjacob #define	PDB24XX_AE_TPRLO_RJT	0x09
   1300       1.51  mjacob #define	PDB24XX_AE_PRLO_RCVD	0x0a
   1301       1.51  mjacob #define	PDB24XX_AE_LOGO_RCVD	0x0b
   1302       1.51  mjacob #define	PDB24XX_AE_TOPO_CHG	0x0c
   1303       1.51  mjacob #define	PDB24XX_AE_NPORT_CHG	0x0d
   1304       1.51  mjacob #define	PDB24XX_AE_FLOGI_RJT	0x0e
   1305       1.51  mjacob #define	PDB24XX_AE_BAD_FANN	0x0f
   1306       1.51  mjacob #define	PDB24XX_AE_FLOGI_TIMO	0x10
   1307       1.51  mjacob #define	PDB24XX_AE_ABX_LOGO	0x11
   1308       1.51  mjacob #define	PDB24XX_AE_PLOGI_DONE	0x12
   1309       1.51  mjacob #define	PDB24XX_AE_PRLI_DONJE	0x13
   1310       1.51  mjacob #define	PDB24XX_AE_OPN_1	0x14
   1311       1.51  mjacob #define	PDB24XX_AE_OPN_2	0x15
   1312       1.51  mjacob #define	PDB24XX_AE_TXERR	0x16
   1313       1.51  mjacob #define	PDB24XX_AE_FORCED_LOGO	0x17
   1314       1.51  mjacob #define	PDB24XX_AE_DISC_TIMO	0x18
   1315       1.51  mjacob 
   1316       1.51  mjacob /*
   1317       1.50  mjacob  * Genericized Port Login/Logout software structure
   1318       1.39  mjacob  */
   1319       1.50  mjacob typedef struct {
   1320       1.50  mjacob 	uint16_t	handle;
   1321       1.51  mjacob 	uint16_t	channel;
   1322       1.50  mjacob 	uint32_t
   1323       1.50  mjacob 		flags	: 8,
   1324       1.50  mjacob 		portid	: 24;
   1325       1.50  mjacob } isp_plcmd_t;
   1326       1.50  mjacob /* the flags to use are those for PLOGX_FLG_* below */
   1327       1.39  mjacob 
   1328       1.50  mjacob /*
   1329       1.50  mjacob  * ISP24XX- Login/Logout Port IOCB
   1330       1.50  mjacob  */
   1331       1.39  mjacob typedef struct {
   1332       1.50  mjacob 	isphdr_t	plogx_header;
   1333       1.50  mjacob 	uint32_t	plogx_handle;
   1334       1.50  mjacob 	uint16_t	plogx_status;
   1335       1.50  mjacob 	uint16_t	plogx_nphdl;
   1336       1.50  mjacob 	uint16_t	plogx_flags;
   1337       1.50  mjacob 	uint16_t	plogx_vphdl;		/* low 8 bits */
   1338       1.50  mjacob 	uint16_t	plogx_portlo;		/* low 16 bits */
   1339       1.50  mjacob 	uint16_t	plogx_rspsz_porthi;
   1340       1.50  mjacob 	struct {
   1341       1.50  mjacob 		uint16_t	lo16;
   1342       1.50  mjacob 		uint16_t	hi16;
   1343       1.50  mjacob 	} plogx_ioparm[11];
   1344       1.50  mjacob } isp_plogx_t;
   1345       1.50  mjacob 
   1346       1.50  mjacob #define	PLOGX_STATUS_OK		0x00
   1347       1.50  mjacob #define	PLOGX_STATUS_UNAVAIL	0x28
   1348       1.50  mjacob #define	PLOGX_STATUS_LOGOUT	0x29
   1349       1.50  mjacob #define	PLOGX_STATUS_IOCBERR	0x31
   1350       1.50  mjacob 
   1351       1.50  mjacob #define	PLOGX_IOCBERR_NOLINK	0x01
   1352       1.50  mjacob #define	PLOGX_IOCBERR_NOIOCB	0x02
   1353       1.50  mjacob #define	PLOGX_IOCBERR_NOXGHG	0x03
   1354       1.50  mjacob #define	PLOGX_IOCBERR_FAILED	0x04	/* further info in IOPARM 1 */
   1355       1.50  mjacob #define	PLOGX_IOCBERR_NOFABRIC	0x05
   1356       1.50  mjacob #define	PLOGX_IOCBERR_NOTREADY	0x07
   1357       1.50  mjacob #define	PLOGX_IOCBERR_NOLOGIN	0x08	/* further info in IOPARM 1 */
   1358       1.50  mjacob #define	PLOGX_IOCBERR_NOPCB	0x0a
   1359       1.50  mjacob #define	PLOGX_IOCBERR_REJECT	0x18	/* further info in IOPARM 1 */
   1360       1.50  mjacob #define	PLOGX_IOCBERR_EINVAL	0x19	/* further info in IOPARM 1 */
   1361       1.50  mjacob #define	PLOGX_IOCBERR_PORTUSED	0x1a	/* further info in IOPARM 1 */
   1362       1.50  mjacob #define	PLOGX_IOCBERR_HNDLUSED	0x1b	/* further info in IOPARM 1 */
   1363       1.50  mjacob #define	PLOGX_IOCBERR_NOHANDLE	0x1c
   1364       1.50  mjacob #define	PLOGX_IOCBERR_NOFLOGI	0x1f	/* further info in IOPARM 1 */
   1365       1.50  mjacob 
   1366       1.50  mjacob #define	PLOGX_FLG_CMD_MASK	0xf
   1367       1.50  mjacob #define	PLOGX_FLG_CMD_PLOGI	0
   1368       1.50  mjacob #define	PLOGX_FLG_CMD_PRLI	1
   1369       1.50  mjacob #define	PLOGX_FLG_CMD_PDISC	2
   1370       1.50  mjacob #define	PLOGX_FLG_CMD_LOGO	8
   1371       1.50  mjacob #define	PLOGX_FLG_CMD_PRLO	9
   1372       1.50  mjacob #define	PLOGX_FLG_CMD_TPRLO	10
   1373       1.50  mjacob 
   1374       1.50  mjacob #define	PLOGX_FLG_COND_PLOGI		0x10	/* if with PLOGI */
   1375       1.50  mjacob #define	PLOGX_FLG_IMPLICIT		0x10	/* if with LOGO, PRLO, TPRLO */
   1376       1.50  mjacob #define	PLOGX_FLG_SKIP_PRLI		0x20	/* if with PLOGI */
   1377       1.50  mjacob #define	PLOGX_FLG_IMPLICIT_LOGO_ALL	0x20	/* if with LOGO */
   1378       1.50  mjacob #define	PLOGX_FLG_EXPLICIT_LOGO		0x40	/* if with LOGO */
   1379       1.50  mjacob #define	PLOGX_FLG_COMMON_FEATURES	0x80	/* if with PLOGI */
   1380       1.50  mjacob #define	PLOGX_FLG_FREE_NPHDL		0x80	/* if with with LOGO */
   1381       1.50  mjacob 
   1382       1.50  mjacob #define	PLOGX_FLG_CLASS2		0x100	/* if with PLOGI */
   1383       1.50  mjacob #define	PLOGX_FLG_FCP2_OVERRIDE		0x200	/* if with PRLOG, PRLI */
   1384       1.39  mjacob 
   1385       1.50  mjacob /*
   1386       1.51  mjacob  * Report ID Acquisistion (24XX multi-id firmware)
   1387       1.51  mjacob  */
   1388       1.51  mjacob typedef struct {
   1389       1.51  mjacob 	isphdr_t	ridacq_hdr;
   1390       1.51  mjacob 	uint32_t	ridacq_handle;
   1391       1.51  mjacob 	union {
   1392       1.51  mjacob 		struct {
   1393       1.51  mjacob 			uint8_t		ridacq_vp_acquired;
   1394       1.51  mjacob 			uint8_t		ridacq_vp_setup;
   1395       1.51  mjacob 			uint16_t	ridacq_reserved0;
   1396       1.51  mjacob 		} type0;	/* type 0 */
   1397       1.51  mjacob 		struct {
   1398       1.51  mjacob 			uint16_t	ridacq_vp_count;
   1399       1.51  mjacob 			uint8_t		ridacq_vp_index;
   1400       1.51  mjacob 			uint8_t		ridacq_vp_status;
   1401       1.51  mjacob 		} type1;	/* type 1 */
   1402       1.51  mjacob 	} un;
   1403       1.51  mjacob 	uint16_t	ridacq_vp_port_lo;
   1404       1.51  mjacob 	uint8_t		ridacq_vp_port_hi;
   1405       1.51  mjacob 	uint8_t		ridacq_format;		/* 0 or 1 */
   1406       1.51  mjacob 	uint16_t	ridacq_map[8];
   1407       1.51  mjacob 	uint8_t		ridacq_reserved1[32];
   1408       1.51  mjacob } isp_ridacq_t;
   1409       1.51  mjacob 
   1410       1.51  mjacob #define	RIDACQ_STS_COMPLETE	0
   1411       1.51  mjacob #define	RIDACQ_STS_UNACQUIRED	1
   1412       1.51  mjacob #define	RIDACQ_STS_CHANGED	20
   1413       1.51  mjacob 
   1414       1.51  mjacob 
   1415       1.51  mjacob /*
   1416       1.50  mjacob  * Simple Name Server Data Structures
   1417       1.50  mjacob  */
   1418       1.39  mjacob #define	SNS_GA_NXT	0x100
   1419       1.39  mjacob #define	SNS_GPN_ID	0x112
   1420       1.39  mjacob #define	SNS_GNN_ID	0x113
   1421       1.40  mjacob #define	SNS_GFF_ID	0x11F
   1422       1.39  mjacob #define	SNS_GID_FT	0x171
   1423       1.39  mjacob #define	SNS_RFT_ID	0x217
   1424       1.18  mjacob typedef struct {
   1425       1.50  mjacob 	uint16_t	snscb_rblen;	/* response buffer length (words) */
   1426       1.50  mjacob 	uint16_t	snscb_reserved0;
   1427       1.50  mjacob 	uint16_t	snscb_addr[4];	/* response buffer address */
   1428       1.50  mjacob 	uint16_t	snscb_sblen;	/* subcommand buffer length (words) */
   1429       1.50  mjacob 	uint16_t	snscb_reserved1;
   1430       1.50  mjacob 	uint16_t	snscb_data[1];	/* variable data */
   1431       1.18  mjacob } sns_screq_t;	/* Subcommand Request Structure */
   1432       1.18  mjacob 
   1433       1.18  mjacob typedef struct {
   1434       1.50  mjacob 	uint16_t	snscb_rblen;	/* response buffer length (words) */
   1435       1.50  mjacob 	uint16_t	snscb_reserved0;
   1436       1.50  mjacob 	uint16_t	snscb_addr[4];	/* response buffer address */
   1437       1.50  mjacob 	uint16_t	snscb_sblen;	/* subcommand buffer length (words) */
   1438       1.50  mjacob 	uint16_t	snscb_reserved1;
   1439       1.50  mjacob 	uint16_t	snscb_cmd;
   1440       1.50  mjacob 	uint16_t	snscb_reserved2;
   1441       1.50  mjacob 	uint32_t	snscb_reserved3;
   1442       1.50  mjacob 	uint32_t	snscb_port;
   1443       1.39  mjacob } sns_ga_nxt_req_t;
   1444       1.39  mjacob #define	SNS_GA_NXT_REQ_SIZE	(sizeof (sns_ga_nxt_req_t))
   1445       1.39  mjacob 
   1446       1.39  mjacob typedef struct {
   1447       1.50  mjacob 	uint16_t	snscb_rblen;	/* response buffer length (words) */
   1448       1.50  mjacob 	uint16_t	snscb_reserved0;
   1449       1.50  mjacob 	uint16_t	snscb_addr[4];	/* response buffer address */
   1450       1.50  mjacob 	uint16_t	snscb_sblen;	/* subcommand buffer length (words) */
   1451       1.50  mjacob 	uint16_t	snscb_reserved1;
   1452       1.50  mjacob 	uint16_t	snscb_cmd;
   1453       1.50  mjacob 	uint16_t	snscb_reserved2;
   1454       1.50  mjacob 	uint32_t	snscb_reserved3;
   1455       1.50  mjacob 	uint32_t	snscb_portid;
   1456       1.39  mjacob } sns_gxn_id_req_t;
   1457       1.39  mjacob #define	SNS_GXN_ID_REQ_SIZE	(sizeof (sns_gxn_id_req_t))
   1458       1.39  mjacob 
   1459       1.39  mjacob typedef struct {
   1460       1.50  mjacob 	uint16_t	snscb_rblen;	/* response buffer length (words) */
   1461       1.50  mjacob 	uint16_t	snscb_reserved0;
   1462       1.50  mjacob 	uint16_t	snscb_addr[4];	/* response buffer address */
   1463       1.50  mjacob 	uint16_t	snscb_sblen;	/* subcommand buffer length (words) */
   1464       1.50  mjacob 	uint16_t	snscb_reserved1;
   1465       1.50  mjacob 	uint16_t	snscb_cmd;
   1466       1.50  mjacob 	uint16_t	snscb_mword_div_2;
   1467       1.50  mjacob 	uint32_t	snscb_reserved3;
   1468       1.50  mjacob 	uint32_t	snscb_fc4_type;
   1469       1.39  mjacob } sns_gid_ft_req_t;
   1470       1.39  mjacob #define	SNS_GID_FT_REQ_SIZE	(sizeof (sns_gid_ft_req_t))
   1471       1.39  mjacob 
   1472       1.39  mjacob typedef struct {
   1473       1.50  mjacob 	uint16_t	snscb_rblen;	/* response buffer length (words) */
   1474       1.50  mjacob 	uint16_t	snscb_reserved0;
   1475       1.50  mjacob 	uint16_t	snscb_addr[4];	/* response buffer address */
   1476       1.50  mjacob 	uint16_t	snscb_sblen;	/* subcommand buffer length (words) */
   1477       1.50  mjacob 	uint16_t	snscb_reserved1;
   1478       1.50  mjacob 	uint16_t	snscb_cmd;
   1479       1.50  mjacob 	uint16_t	snscb_reserved2;
   1480       1.50  mjacob 	uint32_t	snscb_reserved3;
   1481       1.50  mjacob 	uint32_t	snscb_port;
   1482       1.50  mjacob 	uint32_t	snscb_fc4_types[8];
   1483       1.39  mjacob } sns_rft_id_req_t;
   1484       1.39  mjacob #define	SNS_RFT_ID_REQ_SIZE	(sizeof (sns_rft_id_req_t))
   1485       1.39  mjacob 
   1486       1.39  mjacob typedef struct {
   1487       1.39  mjacob 	ct_hdr_t	snscb_cthdr;
   1488       1.50  mjacob 	uint8_t		snscb_port_type;
   1489       1.50  mjacob 	uint8_t		snscb_port_id[3];
   1490       1.50  mjacob 	uint8_t		snscb_portname[8];
   1491       1.50  mjacob 	uint16_t	snscb_data[1];	/* variable data */
   1492       1.18  mjacob } sns_scrsp_t;	/* Subcommand Response Structure */
   1493       1.22  mjacob 
   1494       1.22  mjacob typedef struct {
   1495       1.39  mjacob 	ct_hdr_t	snscb_cthdr;
   1496       1.50  mjacob 	uint8_t		snscb_port_type;
   1497       1.50  mjacob 	uint8_t		snscb_port_id[3];
   1498       1.50  mjacob 	uint8_t		snscb_portname[8];
   1499       1.50  mjacob 	uint8_t		snscb_pnlen;		/* symbolic port name length */
   1500       1.50  mjacob 	uint8_t		snscb_pname[255];	/* symbolic port name */
   1501       1.50  mjacob 	uint8_t		snscb_nodename[8];
   1502       1.50  mjacob 	uint8_t		snscb_nnlen;		/* symbolic node name length */
   1503       1.50  mjacob 	uint8_t		snscb_nname[255];	/* symbolic node name */
   1504       1.50  mjacob 	uint8_t		snscb_ipassoc[8];
   1505       1.50  mjacob 	uint8_t		snscb_ipaddr[16];
   1506       1.50  mjacob 	uint8_t		snscb_svc_class[4];
   1507       1.50  mjacob 	uint8_t		snscb_fc4_types[32];
   1508       1.50  mjacob 	uint8_t		snscb_fpname[8];
   1509       1.50  mjacob 	uint8_t		snscb_reserved;
   1510       1.50  mjacob 	uint8_t		snscb_hardaddr[3];
   1511       1.39  mjacob } sns_ga_nxt_rsp_t;	/* Subcommand Response Structure */
   1512       1.39  mjacob #define	SNS_GA_NXT_RESP_SIZE	(sizeof (sns_ga_nxt_rsp_t))
   1513       1.39  mjacob 
   1514       1.39  mjacob typedef struct {
   1515       1.39  mjacob 	ct_hdr_t	snscb_cthdr;
   1516       1.50  mjacob 	uint8_t		snscb_wwn[8];
   1517       1.39  mjacob } sns_gxn_id_rsp_t;
   1518       1.39  mjacob #define	SNS_GXN_ID_RESP_SIZE	(sizeof (sns_gxn_id_rsp_t))
   1519       1.39  mjacob 
   1520       1.40  mjacob typedef struct {
   1521       1.40  mjacob 	ct_hdr_t	snscb_cthdr;
   1522       1.50  mjacob 	uint32_t	snscb_fc4_features[32];
   1523       1.40  mjacob } sns_gff_id_rsp_t;
   1524       1.40  mjacob #define	SNS_GFF_ID_RESP_SIZE	(sizeof (sns_gff_id_rsp_t))
   1525       1.39  mjacob 
   1526       1.39  mjacob typedef struct {
   1527       1.39  mjacob 	ct_hdr_t	snscb_cthdr;
   1528       1.39  mjacob 	struct {
   1529       1.50  mjacob 		uint8_t		control;
   1530       1.50  mjacob 		uint8_t		portid[3];
   1531       1.39  mjacob 	} snscb_ports[1];
   1532       1.39  mjacob } sns_gid_ft_rsp_t;
   1533       1.39  mjacob #define	SNS_GID_FT_RESP_SIZE(x)	((sizeof (sns_gid_ft_rsp_t)) + ((x - 1) << 2))
   1534       1.50  mjacob #define	SNS_RFT_ID_RESP_SIZE	(sizeof (ct_hdr_t))
   1535       1.39  mjacob 
   1536       1.50  mjacob /*
   1537       1.50  mjacob  * Other Misc Structures
   1538       1.50  mjacob  */
   1539        1.1     cgd 
   1540       1.50  mjacob /* ELS Pass Through */
   1541       1.50  mjacob typedef struct {
   1542       1.50  mjacob 	isphdr_t	els_hdr;
   1543       1.50  mjacob 	uint32_t	els_handle;
   1544       1.50  mjacob 	uint16_t	els_status;
   1545       1.50  mjacob 	uint16_t	els_nphdl;
   1546       1.50  mjacob 	uint16_t	els_xmit_dsd_count;	/* outgoing only */
   1547       1.50  mjacob 	uint8_t		els_vphdl;
   1548       1.50  mjacob 	uint8_t		els_sof;
   1549       1.50  mjacob 	uint32_t	els_rxid;
   1550       1.50  mjacob 	uint16_t	els_recv_dsd_count;	/* outgoing only */
   1551       1.50  mjacob 	uint8_t		els_opcode;
   1552       1.50  mjacob 	uint8_t		els_reserved1;
   1553       1.50  mjacob 	uint8_t		els_did_lo;
   1554       1.50  mjacob 	uint8_t		els_did_mid;
   1555       1.50  mjacob 	uint8_t		els_did_hi;
   1556       1.50  mjacob 	uint8_t		els_reserved2;
   1557       1.50  mjacob 	uint16_t	els_reserved3;
   1558       1.50  mjacob 	uint16_t	els_ctl_flags;
   1559       1.50  mjacob 	union {
   1560       1.50  mjacob 		struct {
   1561       1.50  mjacob 			uint32_t	_els_bytecnt;
   1562       1.50  mjacob 			uint32_t	_els_subcode1;
   1563       1.50  mjacob 			uint32_t	_els_subcode2;
   1564       1.50  mjacob 			uint8_t		_els_reserved4[20];
   1565       1.50  mjacob 		} in;
   1566       1.50  mjacob 		struct {
   1567       1.50  mjacob 			uint32_t	_els_recv_bytecnt;
   1568       1.50  mjacob 			uint32_t	_els_xmit_bytecnt;
   1569       1.50  mjacob 			uint32_t	_els_xmit_dsd_length;
   1570       1.50  mjacob 			uint16_t	_els_xmit_dsd_a1500;
   1571       1.50  mjacob 			uint16_t	_els_xmit_dsd_a3116;
   1572       1.50  mjacob 			uint16_t	_els_xmit_dsd_a4732;
   1573       1.50  mjacob 			uint16_t	_els_xmit_dsd_a6348;
   1574       1.50  mjacob 			uint32_t	_els_recv_dsd_length;
   1575       1.50  mjacob 			uint16_t	_els_recv_dsd_a1500;
   1576       1.50  mjacob 			uint16_t	_els_recv_dsd_a3116;
   1577       1.50  mjacob 			uint16_t	_els_recv_dsd_a4732;
   1578       1.50  mjacob 			uint16_t	_els_recv_dsd_a6348;
   1579       1.50  mjacob 		} out;
   1580       1.50  mjacob 	} inout;
   1581       1.50  mjacob #define	els_bytecnt		inout.in._els_bytecnt
   1582       1.50  mjacob #define	els_subcode1		inout.in._els_subcode1
   1583       1.50  mjacob #define	els_subcode2		inout.in._els_subcode2
   1584       1.50  mjacob #define	els_reserved4		inout.in._els_reserved4
   1585       1.50  mjacob #define	els_recv_bytecnt	inout.out._els_recv_bytecnt
   1586       1.50  mjacob #define	els_xmit_bytecnt	inout.out._els_xmit_bytecnt
   1587       1.50  mjacob #define	els_xmit_dsd_length	inout.out._els_xmit_dsd_length
   1588       1.50  mjacob #define	els_xmit_dsd_a1500	inout.out._els_xmit_dsd_a1500
   1589       1.50  mjacob #define	els_xmit_dsd_a3116	inout.out._els_xmit_dsd_a3116
   1590       1.50  mjacob #define	els_xmit_dsd_a4732	inout.out._els_xmit_dsd_a4732
   1591       1.50  mjacob #define	els_xmit_dsd_a6348	inout.out._els_xmit_dsd_a6348
   1592       1.50  mjacob #define	els_recv_dsd_length	inout.out._els_recv_dsd_length
   1593       1.50  mjacob #define	els_recv_dsd_a1500	inout.out._els_recv_dsd_a1500
   1594       1.50  mjacob #define	els_recv_dsd_a3116	inout.out._els_recv_dsd_a3116
   1595       1.50  mjacob #define	els_recv_dsd_a4732	inout.out._els_recv_dsd_a4732
   1596       1.50  mjacob #define	els_recv_dsd_a6348	inout.out._els_recv_dsd_a6348
   1597       1.50  mjacob } els_t;
   1598       1.50  mjacob 
   1599       1.50  mjacob /*
   1600       1.51  mjacob  * A handy package structure for running FC-SCSI commands internally
   1601       1.50  mjacob  */
   1602       1.50  mjacob typedef struct {
   1603       1.50  mjacob 	uint16_t	handle;
   1604       1.50  mjacob 	uint16_t	lun;
   1605       1.51  mjacob 	uint32_t
   1606       1.51  mjacob 		channel : 8,
   1607       1.51  mjacob 		portid	: 24;
   1608       1.50  mjacob 	uint32_t	timeout;
   1609       1.50  mjacob 	union {
   1610       1.50  mjacob 		struct {
   1611       1.50  mjacob 			uint32_t data_length;
   1612       1.51  mjacob 			uint32_t
   1613       1.51  mjacob 				no_wait : 1,
   1614       1.51  mjacob 				do_read : 1;
   1615       1.50  mjacob 			uint8_t cdb[16];
   1616       1.50  mjacob 			void *data_ptr;
   1617       1.50  mjacob 		} beg;
   1618       1.50  mjacob 		struct {
   1619       1.50  mjacob 			uint32_t data_residual;
   1620       1.50  mjacob 			uint8_t status;
   1621       1.50  mjacob 			uint8_t pad;
   1622       1.50  mjacob 			uint16_t sense_length;
   1623       1.50  mjacob 			uint8_t sense_data[32];
   1624       1.50  mjacob 		} end;
   1625       1.50  mjacob 	} fcd;
   1626       1.50  mjacob } isp_xcmd_t;
   1627  1.52.12.1     jym 
   1628  1.52.12.1     jym /*
   1629  1.52.12.1     jym  * Target Mode related definitions
   1630  1.52.12.1     jym  */
   1631  1.52.12.1     jym #define	QLTM_SENSELEN	18	/* non-FC cards only */
   1632  1.52.12.1     jym #define QLTM_SVALID	0x80
   1633  1.52.12.1     jym 
   1634  1.52.12.1     jym /*
   1635  1.52.12.1     jym  * Structure for Enable Lun and Modify Lun queue entries
   1636  1.52.12.1     jym  */
   1637  1.52.12.1     jym typedef struct {
   1638  1.52.12.1     jym 	isphdr_t	le_header;
   1639  1.52.12.1     jym 	uint32_t	le_reserved;
   1640  1.52.12.1     jym 	uint8_t		le_lun;
   1641  1.52.12.1     jym 	uint8_t		le_rsvd;
   1642  1.52.12.1     jym 	uint8_t		le_ops;		/* Modify LUN only */
   1643  1.52.12.1     jym 	uint8_t		le_tgt;		/* Not for FC */
   1644  1.52.12.1     jym 	uint32_t	le_flags;	/* Not for FC */
   1645  1.52.12.1     jym 	uint8_t		le_status;
   1646  1.52.12.1     jym 	uint8_t		le_reserved2;
   1647  1.52.12.1     jym 	uint8_t		le_cmd_count;
   1648  1.52.12.1     jym 	uint8_t		le_in_count;
   1649  1.52.12.1     jym 	uint8_t		le_cdb6len;	/* Not for FC */
   1650  1.52.12.1     jym 	uint8_t		le_cdb7len;	/* Not for FC */
   1651  1.52.12.1     jym 	uint16_t	le_timeout;
   1652  1.52.12.1     jym 	uint16_t	le_reserved3[20];
   1653  1.52.12.1     jym } lun_entry_t;
   1654  1.52.12.1     jym 
   1655  1.52.12.1     jym /*
   1656  1.52.12.1     jym  * le_flags values
   1657  1.52.12.1     jym  */
   1658  1.52.12.1     jym #define LUN_TQAE	0x00000002	/* bit1  Tagged Queue Action Enable */
   1659  1.52.12.1     jym #define LUN_DSSM	0x01000000	/* bit24 Disable Sending SDP Message */
   1660  1.52.12.1     jym #define	LUN_DISAD	0x02000000	/* bit25 Disable autodisconnect */
   1661  1.52.12.1     jym #define LUN_DM		0x40000000	/* bit30 Disconnects Mandatory */
   1662  1.52.12.1     jym 
   1663  1.52.12.1     jym /*
   1664  1.52.12.1     jym  * le_ops values
   1665  1.52.12.1     jym  */
   1666  1.52.12.1     jym #define LUN_CCINCR	0x01	/* increment command count */
   1667  1.52.12.1     jym #define LUN_CCDECR	0x02	/* decrement command count */
   1668  1.52.12.1     jym #define LUN_ININCR	0x40	/* increment immed. notify count */
   1669  1.52.12.1     jym #define LUN_INDECR	0x80	/* decrement immed. notify count */
   1670  1.52.12.1     jym 
   1671  1.52.12.1     jym /*
   1672  1.52.12.1     jym  * le_status values
   1673  1.52.12.1     jym  */
   1674  1.52.12.1     jym #define	LUN_OK		0x01	/* we be rockin' */
   1675  1.52.12.1     jym #define LUN_ERR		0x04	/* request completed with error */
   1676  1.52.12.1     jym #define LUN_INVAL	0x06	/* invalid request */
   1677  1.52.12.1     jym #define LUN_NOCAP	0x16	/* can't provide requested capability */
   1678  1.52.12.1     jym #define LUN_ENABLED	0x3E	/* LUN already enabled */
   1679  1.52.12.1     jym 
   1680  1.52.12.1     jym /*
   1681  1.52.12.1     jym  * Immediate Notify Entry structure
   1682  1.52.12.1     jym  */
   1683  1.52.12.1     jym #define IN_MSGLEN	8	/* 8 bytes */
   1684  1.52.12.1     jym #define IN_RSVDLEN	8	/* 8 words */
   1685  1.52.12.1     jym typedef struct {
   1686  1.52.12.1     jym 	isphdr_t	in_header;
   1687  1.52.12.1     jym 	uint32_t	in_reserved;
   1688  1.52.12.1     jym 	uint8_t		in_lun;		/* lun */
   1689  1.52.12.1     jym 	uint8_t		in_iid;		/* initiator */
   1690  1.52.12.1     jym 	uint8_t		in_reserved2;
   1691  1.52.12.1     jym 	uint8_t		in_tgt;		/* target */
   1692  1.52.12.1     jym 	uint32_t	in_flags;
   1693  1.52.12.1     jym 	uint8_t		in_status;
   1694  1.52.12.1     jym 	uint8_t		in_rsvd2;
   1695  1.52.12.1     jym 	uint8_t		in_tag_val;	/* tag value */
   1696  1.52.12.1     jym 	uint8_t		in_tag_type;	/* tag type */
   1697  1.52.12.1     jym 	uint16_t	in_seqid;	/* sequence id */
   1698  1.52.12.1     jym 	uint8_t		in_msg[IN_MSGLEN];	/* SCSI message bytes */
   1699  1.52.12.1     jym 	uint16_t	in_reserved3[IN_RSVDLEN];
   1700  1.52.12.1     jym 	uint8_t		in_sense[QLTM_SENSELEN];/* suggested sense data */
   1701  1.52.12.1     jym } in_entry_t;
   1702  1.52.12.1     jym 
   1703  1.52.12.1     jym typedef struct {
   1704  1.52.12.1     jym 	isphdr_t	in_header;
   1705  1.52.12.1     jym 	uint32_t	in_reserved;
   1706  1.52.12.1     jym 	uint8_t		in_lun;		/* lun */
   1707  1.52.12.1     jym 	uint8_t		in_iid;		/* initiator */
   1708  1.52.12.1     jym 	uint16_t	in_scclun;
   1709  1.52.12.1     jym 	uint32_t	in_reserved2;
   1710  1.52.12.1     jym 	uint16_t	in_status;
   1711  1.52.12.1     jym 	uint16_t	in_task_flags;
   1712  1.52.12.1     jym 	uint16_t	in_seqid;	/* sequence id */
   1713  1.52.12.1     jym } in_fcentry_t;
   1714  1.52.12.1     jym 
   1715  1.52.12.1     jym typedef struct {
   1716  1.52.12.1     jym 	isphdr_t	in_header;
   1717  1.52.12.1     jym 	uint32_t	in_reserved;
   1718  1.52.12.1     jym 	uint16_t	in_iid;		/* initiator */
   1719  1.52.12.1     jym 	uint16_t	in_scclun;
   1720  1.52.12.1     jym 	uint32_t	in_reserved2;
   1721  1.52.12.1     jym 	uint16_t	in_status;
   1722  1.52.12.1     jym 	uint16_t	in_task_flags;
   1723  1.52.12.1     jym 	uint16_t	in_seqid;	/* sequence id */
   1724  1.52.12.1     jym } in_fcentry_e_t;
   1725  1.52.12.1     jym 
   1726  1.52.12.1     jym /*
   1727  1.52.12.1     jym  * Values for the in_status field
   1728  1.52.12.1     jym  */
   1729  1.52.12.1     jym #define	IN_REJECT	0x0D	/* Message Reject message received */
   1730  1.52.12.1     jym #define IN_RESET	0x0E	/* Bus Reset occurred */
   1731  1.52.12.1     jym #define IN_NO_RCAP	0x16	/* requested capability not available */
   1732  1.52.12.1     jym #define IN_IDE_RECEIVED	0x33	/* Initiator Detected Error msg received */
   1733  1.52.12.1     jym #define IN_RSRC_UNAVAIL	0x34	/* resource unavailable */
   1734  1.52.12.1     jym #define IN_MSG_RECEIVED	0x36	/* SCSI message received */
   1735  1.52.12.1     jym #define	IN_ABORT_TASK	0x20	/* task named in RX_ID is being aborted (FC) */
   1736  1.52.12.1     jym #define	IN_PORT_LOGOUT	0x29	/* port has logged out (FC) */
   1737  1.52.12.1     jym #define	IN_PORT_CHANGED	0x2A	/* port changed */
   1738  1.52.12.1     jym #define	IN_GLOBAL_LOGO	0x2E	/* all ports logged out */
   1739  1.52.12.1     jym #define	IN_NO_NEXUS	0x3B	/* Nexus not established */
   1740  1.52.12.1     jym 
   1741  1.52.12.1     jym /*
   1742  1.52.12.1     jym  * Values for the in_task_flags field- should only get one at a time!
   1743  1.52.12.1     jym  */
   1744  1.52.12.1     jym #define	TASK_FLAGS_RESERVED_MASK	(0xe700)
   1745  1.52.12.1     jym #define	TASK_FLAGS_CLEAR_ACA		(1<<14)
   1746  1.52.12.1     jym #define	TASK_FLAGS_TARGET_RESET		(1<<13)
   1747  1.52.12.1     jym #define	TASK_FLAGS_LUN_RESET		(1<<12)
   1748  1.52.12.1     jym #define	TASK_FLAGS_CLEAR_TASK_SET	(1<<10)
   1749  1.52.12.1     jym #define	TASK_FLAGS_ABORT_TASK_SET	(1<<9)
   1750  1.52.12.1     jym 
   1751  1.52.12.1     jym /*
   1752  1.52.12.1     jym  * ISP24XX Immediate Notify
   1753  1.52.12.1     jym  */
   1754  1.52.12.1     jym typedef struct {
   1755  1.52.12.1     jym 	isphdr_t	in_header;
   1756  1.52.12.1     jym 	uint32_t	in_reserved;
   1757  1.52.12.1     jym 	uint16_t	in_nphdl;
   1758  1.52.12.1     jym 	uint16_t	in_reserved1;
   1759  1.52.12.1     jym 	uint16_t	in_flags;
   1760  1.52.12.1     jym 	uint16_t	in_srr_rxid;
   1761  1.52.12.1     jym 	uint16_t	in_status;
   1762  1.52.12.1     jym 	uint8_t		in_status_subcode;
   1763  1.52.12.1     jym 	uint8_t		in_reserved2;
   1764  1.52.12.1     jym 	uint32_t	in_rxid;
   1765  1.52.12.1     jym 	uint16_t	in_srr_reloff_lo;
   1766  1.52.12.1     jym 	uint16_t	in_srr_reloff_hi;
   1767  1.52.12.1     jym 	uint16_t	in_srr_iu;
   1768  1.52.12.1     jym 	uint16_t	in_srr_oxid;
   1769  1.52.12.1     jym 	/*
   1770  1.52.12.1     jym 	 * If bit 2 is set in in_flags, the following
   1771  1.52.12.1     jym 	 * two tags are valid. If the received ELS is
   1772  1.52.12.1     jym 	 * a LOGO, then these tags contain the N Port ID
   1773  1.52.12.1     jym 	 * from the LOGO payload. If the received ELS
   1774  1.52.12.1     jym 	 * request is TPRLO, these tags contain the
   1775  1.52.12.1     jym 	 * Third Party Originator N Port ID.
   1776  1.52.12.1     jym 	 */
   1777  1.52.12.1     jym 	uint16_t	in_nport_id_hi;
   1778  1.52.12.1     jym 	uint8_t		in_nport_id_lo;
   1779  1.52.12.1     jym 	uint8_t		in_reserved3;
   1780  1.52.12.1     jym 	/*
   1781  1.52.12.1     jym 	 * If bit 2 is set in in_flags, the following
   1782  1.52.12.1     jym 	 * tag is valid. If the received ELS is a LOGO,
   1783  1.52.12.1     jym 	 * then this tag contains the n-port handle
   1784  1.52.12.1     jym 	 * from the LOGO payload. If the received ELS
   1785  1.52.12.1     jym 	 * request is TPRLO, this tag contain the
   1786  1.52.12.1     jym 	 * n-port handle for the Third Party Originator.
   1787  1.52.12.1     jym 	 */
   1788  1.52.12.1     jym 	uint16_t	in_np_handle;
   1789  1.52.12.1     jym 	uint8_t		in_reserved4[12];
   1790  1.52.12.1     jym 	uint8_t		in_reserved5;
   1791  1.52.12.1     jym 	uint8_t		in_vpidx;
   1792  1.52.12.1     jym 	uint32_t	in_reserved6;
   1793  1.52.12.1     jym 	uint16_t	in_portid_lo;
   1794  1.52.12.1     jym 	uint8_t		in_portid_hi;
   1795  1.52.12.1     jym 	uint8_t		in_reserved7;
   1796  1.52.12.1     jym 	uint16_t	in_reserved8;
   1797  1.52.12.1     jym 	uint16_t	in_oxid;
   1798  1.52.12.1     jym } in_fcentry_24xx_t;
   1799  1.52.12.1     jym 
   1800  1.52.12.1     jym #define	IN24XX_FLAG_PUREX_IOCB		0x1
   1801  1.52.12.1     jym #define	IN24XX_FLAG_GLOBAL_LOGOUT	0x2
   1802  1.52.12.1     jym #define	IN24XX_FLAG_NPHDL_VALID		0x4
   1803  1.52.12.1     jym 
   1804  1.52.12.1     jym #define	IN24XX_LIP_RESET	0x0E
   1805  1.52.12.1     jym #define	IN24XX_LINK_RESET	0x0F
   1806  1.52.12.1     jym #define	IN24XX_PORT_LOGOUT	0x29
   1807  1.52.12.1     jym #define	IN24XX_PORT_CHANGED	0x2A
   1808  1.52.12.1     jym #define	IN24XX_LINK_FAILED	0x2E
   1809  1.52.12.1     jym #define	IN24XX_SRR_RCVD		0x45
   1810  1.52.12.1     jym #define	IN24XX_ELS_RCVD		0x46	/*
   1811  1.52.12.1     jym 					 * login-affectin ELS received- check
   1812  1.52.12.1     jym 					 * subcode for specific opcode
   1813  1.52.12.1     jym 					 */
   1814  1.52.12.1     jym 
   1815  1.52.12.1     jym /*
   1816  1.52.12.1     jym  * For f/w > 4.0.25, these offsets in the Immediate Notify contain
   1817  1.52.12.1     jym  * the WWNN/WWPN if the ELS is PLOGI, PDISC or ADISC. The WWN is in
   1818  1.52.12.1     jym  * Big Endian format.
   1819  1.52.12.1     jym  */
   1820  1.52.12.1     jym #define	IN24XX_PLOGI_WWNN_OFF	0x20
   1821  1.52.12.1     jym #define	IN24XX_PLOGI_WWPN_OFF	0x28
   1822  1.52.12.1     jym 
   1823  1.52.12.1     jym /*
   1824  1.52.12.1     jym  * For f/w > 4.0.25, this offset in the Immediate Notify contain
   1825  1.52.12.1     jym  * the WWPN if the ELS is LOGO. The WWN is in Big Endian format.
   1826  1.52.12.1     jym  */
   1827  1.52.12.1     jym #define	IN24XX_LOGO_WWPN_OFF	0x28
   1828  1.52.12.1     jym 
   1829  1.52.12.1     jym /*
   1830  1.52.12.1     jym  * Immediate Notify Status Subcodes for IN24XX_PORT_LOGOUT
   1831  1.52.12.1     jym  */
   1832  1.52.12.1     jym #define	IN24XX_PORT_LOGOUT_PDISC_TMO	0x00
   1833  1.52.12.1     jym #define	IN24XX_PORT_LOGOUT_UXPR_DISC	0x01
   1834  1.52.12.1     jym #define	IN24XX_PORT_LOGOUT_OWN_OPN	0x02
   1835  1.52.12.1     jym #define	IN24XX_PORT_LOGOUT_OWN_OPN_SFT	0x03
   1836  1.52.12.1     jym #define	IN24XX_PORT_LOGOUT_ABTS_TMO	0x04
   1837  1.52.12.1     jym #define	IN24XX_PORT_LOGOUT_DISC_RJT	0x05
   1838  1.52.12.1     jym #define	IN24XX_PORT_LOGOUT_LOGIN_NEEDED	0x06
   1839  1.52.12.1     jym #define	IN24XX_PORT_LOGOUT_BAD_DISC	0x07
   1840  1.52.12.1     jym #define	IN24XX_PORT_LOGOUT_LOST_ALPA	0x08
   1841  1.52.12.1     jym #define	IN24XX_PORT_LOGOUT_XMIT_FAILURE	0x09
   1842  1.52.12.1     jym 
   1843  1.52.12.1     jym /*
   1844  1.52.12.1     jym  * Immediate Notify Status Subcodes for IN24XX_PORT_CHANGED
   1845  1.52.12.1     jym  */
   1846  1.52.12.1     jym #define	IN24XX_PORT_CHANGED_BADFAN	0x00
   1847  1.52.12.1     jym #define	IN24XX_PORT_CHANGED_TOPO_CHANGE	0x01
   1848  1.52.12.1     jym #define	IN24XX_PORT_CHANGED_FLOGI_ACC	0x02
   1849  1.52.12.1     jym #define	IN24XX_PORT_CHANGED_FLOGI_RJT	0x03
   1850  1.52.12.1     jym #define	IN24XX_PORT_CHANGED_TIMEOUT	0x04
   1851  1.52.12.1     jym #define	IN24XX_PORT_CHANGED_PORT_CHANGE	0x05
   1852  1.52.12.1     jym 
   1853  1.52.12.1     jym /*
   1854  1.52.12.1     jym  * Notify Acknowledge Entry structure
   1855  1.52.12.1     jym  */
   1856  1.52.12.1     jym #define NA_RSVDLEN	22
   1857  1.52.12.1     jym typedef struct {
   1858  1.52.12.1     jym 	isphdr_t	na_header;
   1859  1.52.12.1     jym 	uint32_t	na_reserved;
   1860  1.52.12.1     jym 	uint8_t		na_lun;		/* lun */
   1861  1.52.12.1     jym 	uint8_t		na_iid;		/* initiator */
   1862  1.52.12.1     jym 	uint8_t		na_reserved2;
   1863  1.52.12.1     jym 	uint8_t		na_tgt;		/* target */
   1864  1.52.12.1     jym 	uint32_t	na_flags;
   1865  1.52.12.1     jym 	uint8_t		na_status;
   1866  1.52.12.1     jym 	uint8_t		na_event;
   1867  1.52.12.1     jym 	uint16_t	na_seqid;	/* sequence id */
   1868  1.52.12.1     jym 	uint16_t	na_reserved3[NA_RSVDLEN];
   1869  1.52.12.1     jym } na_entry_t;
   1870  1.52.12.1     jym 
   1871  1.52.12.1     jym /*
   1872  1.52.12.1     jym  * Value for the na_event field
   1873  1.52.12.1     jym  */
   1874  1.52.12.1     jym #define NA_RST_CLRD	0x80	/* Clear an async event notification */
   1875  1.52.12.1     jym #define	NA_OK		0x01	/* Notify Acknowledge Succeeded */
   1876  1.52.12.1     jym #define	NA_INVALID	0x06	/* Invalid Notify Acknowledge */
   1877  1.52.12.1     jym 
   1878  1.52.12.1     jym #define	NA2_RSVDLEN	21
   1879  1.52.12.1     jym typedef struct {
   1880  1.52.12.1     jym 	isphdr_t	na_header;
   1881  1.52.12.1     jym 	uint32_t	na_reserved;
   1882  1.52.12.1     jym 	uint8_t		na_reserved1;
   1883  1.52.12.1     jym 	uint8_t		na_iid;		/* initiator loop id */
   1884  1.52.12.1     jym 	uint16_t	na_response;
   1885  1.52.12.1     jym 	uint16_t	na_flags;
   1886  1.52.12.1     jym 	uint16_t	na_reserved2;
   1887  1.52.12.1     jym 	uint16_t	na_status;
   1888  1.52.12.1     jym 	uint16_t	na_task_flags;
   1889  1.52.12.1     jym 	uint16_t	na_seqid;	/* sequence id */
   1890  1.52.12.1     jym 	uint16_t	na_reserved3[NA2_RSVDLEN];
   1891  1.52.12.1     jym } na_fcentry_t;
   1892  1.52.12.1     jym 
   1893  1.52.12.1     jym typedef struct {
   1894  1.52.12.1     jym 	isphdr_t	na_header;
   1895  1.52.12.1     jym 	uint32_t	na_reserved;
   1896  1.52.12.1     jym 	uint16_t	na_iid;		/* initiator loop id */
   1897  1.52.12.1     jym 	uint16_t	na_response;	/* response code */
   1898  1.52.12.1     jym 	uint16_t	na_flags;
   1899  1.52.12.1     jym 	uint16_t	na_reserved2;
   1900  1.52.12.1     jym 	uint16_t	na_status;
   1901  1.52.12.1     jym 	uint16_t	na_task_flags;
   1902  1.52.12.1     jym 	uint16_t	na_seqid;	/* sequence id */
   1903  1.52.12.1     jym 	uint16_t	na_reserved3[NA2_RSVDLEN];
   1904  1.52.12.1     jym } na_fcentry_e_t;
   1905  1.52.12.1     jym 
   1906  1.52.12.1     jym #define	NAFC_RCOUNT	0x80	/* increment resource count */
   1907  1.52.12.1     jym #define NAFC_RST_CLRD	0x20	/* Clear LIP Reset */
   1908  1.52.12.1     jym #define	NAFC_TVALID	0x10	/* task mangement response code is valid */
   1909  1.52.12.1     jym 
   1910  1.52.12.1     jym /*
   1911  1.52.12.1     jym  * ISP24XX Notify Acknowledge
   1912  1.52.12.1     jym  */
   1913  1.52.12.1     jym 
   1914  1.52.12.1     jym typedef struct {
   1915  1.52.12.1     jym 	isphdr_t	na_header;
   1916  1.52.12.1     jym 	uint32_t	na_handle;
   1917  1.52.12.1     jym 	uint16_t	na_nphdl;
   1918  1.52.12.1     jym 	uint16_t	na_reserved1;
   1919  1.52.12.1     jym 	uint16_t	na_flags;
   1920  1.52.12.1     jym 	uint16_t	na_srr_rxid;
   1921  1.52.12.1     jym 	uint16_t	na_status;
   1922  1.52.12.1     jym 	uint8_t		na_status_subcode;
   1923  1.52.12.1     jym 	uint8_t		na_reserved2;
   1924  1.52.12.1     jym 	uint32_t	na_rxid;
   1925  1.52.12.1     jym 	uint16_t	na_srr_reloff_lo;
   1926  1.52.12.1     jym 	uint16_t	na_srr_reloff_hi;
   1927  1.52.12.1     jym 	uint16_t	na_srr_iu;
   1928  1.52.12.1     jym 	uint16_t	na_srr_flags;
   1929  1.52.12.1     jym 	uint8_t		na_reserved3[18];
   1930  1.52.12.1     jym 	uint8_t		na_reserved4;
   1931  1.52.12.1     jym 	uint8_t		na_vpidx;
   1932  1.52.12.1     jym 	uint8_t		na_srr_reject_vunique;
   1933  1.52.12.1     jym 	uint8_t		na_srr_reject_explanation;
   1934  1.52.12.1     jym 	uint8_t		na_srr_reject_code;
   1935  1.52.12.1     jym 	uint8_t		na_reserved5;
   1936  1.52.12.1     jym 	uint8_t		na_reserved6[6];
   1937  1.52.12.1     jym 	uint16_t	na_oxid;
   1938  1.52.12.1     jym } na_fcentry_24xx_t;
   1939  1.52.12.1     jym 
   1940  1.52.12.1     jym /*
   1941  1.52.12.1     jym  * Accept Target I/O Entry structure
   1942  1.52.12.1     jym  */
   1943  1.52.12.1     jym #define ATIO_CDBLEN	26
   1944  1.52.12.1     jym 
   1945  1.52.12.1     jym typedef struct {
   1946  1.52.12.1     jym 	isphdr_t	at_header;
   1947  1.52.12.1     jym 	uint16_t	at_reserved;
   1948  1.52.12.1     jym 	uint16_t	at_handle;
   1949  1.52.12.1     jym 	uint8_t		at_lun;		/* lun */
   1950  1.52.12.1     jym 	uint8_t		at_iid;		/* initiator */
   1951  1.52.12.1     jym 	uint8_t		at_cdblen; 	/* cdb length */
   1952  1.52.12.1     jym 	uint8_t		at_tgt;		/* target */
   1953  1.52.12.1     jym 	uint32_t	at_flags;
   1954  1.52.12.1     jym 	uint8_t		at_status;	/* firmware status */
   1955  1.52.12.1     jym 	uint8_t		at_scsi_status;	/* scsi status */
   1956  1.52.12.1     jym 	uint8_t		at_tag_val;	/* tag value */
   1957  1.52.12.1     jym 	uint8_t		at_tag_type;	/* tag type */
   1958  1.52.12.1     jym 	uint8_t		at_cdb[ATIO_CDBLEN];	/* received CDB */
   1959  1.52.12.1     jym 	uint8_t		at_sense[QLTM_SENSELEN];/* suggested sense data */
   1960  1.52.12.1     jym } at_entry_t;
   1961  1.52.12.1     jym 
   1962  1.52.12.1     jym /*
   1963  1.52.12.1     jym  * at_flags values
   1964  1.52.12.1     jym  */
   1965  1.52.12.1     jym #define AT_NODISC	0x00008000	/* disconnect disabled */
   1966  1.52.12.1     jym #define AT_TQAE		0x00000002	/* Tagged Queue Action enabled */
   1967  1.52.12.1     jym 
   1968  1.52.12.1     jym /*
   1969  1.52.12.1     jym  * at_status values
   1970  1.52.12.1     jym  */
   1971  1.52.12.1     jym #define AT_PATH_INVALID	0x07	/* ATIO sent to firmware for disabled lun */
   1972  1.52.12.1     jym #define	AT_RESET	0x0E	/* SCSI Bus Reset Occurred */
   1973  1.52.12.1     jym #define AT_PHASE_ERROR	0x14	/* Bus phase sequence error */
   1974  1.52.12.1     jym #define AT_NOCAP	0x16	/* Requested capability not available */
   1975  1.52.12.1     jym #define AT_BDR_MSG	0x17	/* Bus Device Reset msg received */
   1976  1.52.12.1     jym #define AT_CDB		0x3D	/* CDB received */
   1977  1.52.12.1     jym /*
   1978  1.52.12.1     jym  * Macros to create and fetch and test concatenated handle and tag value macros
   1979  1.52.12.1     jym  * (SPI only)
   1980  1.52.12.1     jym  */
   1981  1.52.12.1     jym #define	AT_MAKE_TAGID(tid, aep)						\
   1982  1.52.12.1     jym 	tid = aep->at_handle;						\
   1983  1.52.12.1     jym 	if (aep->at_flags & AT_TQAE) {					\
   1984  1.52.12.1     jym 		tid |= (aep->at_tag_val << 16);				\
   1985  1.52.12.1     jym 		tid |= (1 << 24);					\
   1986  1.52.12.1     jym 	}
   1987  1.52.12.1     jym 
   1988  1.52.12.1     jym #define	CT_MAKE_TAGID(tid, ct)						\
   1989  1.52.12.1     jym 	tid = ct->ct_fwhandle;						\
   1990  1.52.12.1     jym 	if (ct->ct_flags & CT_TQAE) {					\
   1991  1.52.12.1     jym 		tid |= (ct->ct_tag_val << 16);				\
   1992  1.52.12.1     jym 		tid |= (1 << 24);					\
   1993  1.52.12.1     jym 	}
   1994  1.52.12.1     jym 
   1995  1.52.12.1     jym #define	AT_HAS_TAG(val)		((val) & (1 << 24))
   1996  1.52.12.1     jym #define	AT_GET_TAG(val)		(((val) >> 16) & 0xff)
   1997  1.52.12.1     jym #define	AT_GET_HANDLE(val)	((val) & 0xffff)
   1998  1.52.12.1     jym 
   1999  1.52.12.1     jym #define	IN_MAKE_TAGID(tid, inp)						\
   2000  1.52.12.1     jym 	tid = inp->in_seqid;						\
   2001  1.52.12.1     jym 	tid |= (inp->in_tag_val << 16);					\
   2002  1.52.12.1     jym 	tid |= (1 << 24)
   2003  1.52.12.1     jym 
   2004  1.52.12.1     jym /*
   2005  1.52.12.1     jym  * Accept Target I/O Entry structure, Type 2
   2006  1.52.12.1     jym  */
   2007  1.52.12.1     jym #define ATIO2_CDBLEN	16
   2008  1.52.12.1     jym 
   2009  1.52.12.1     jym typedef struct {
   2010  1.52.12.1     jym 	isphdr_t	at_header;
   2011  1.52.12.1     jym 	uint32_t	at_reserved;
   2012  1.52.12.1     jym 	uint8_t		at_lun;		/* lun or reserved */
   2013  1.52.12.1     jym 	uint8_t		at_iid;		/* initiator */
   2014  1.52.12.1     jym 	uint16_t	at_rxid; 	/* response ID */
   2015  1.52.12.1     jym 	uint16_t	at_flags;
   2016  1.52.12.1     jym 	uint16_t	at_status;	/* firmware status */
   2017  1.52.12.1     jym 	uint8_t		at_crn;		/* command reference number */
   2018  1.52.12.1     jym 	uint8_t		at_taskcodes;
   2019  1.52.12.1     jym 	uint8_t		at_taskflags;
   2020  1.52.12.1     jym 	uint8_t		at_execodes;
   2021  1.52.12.1     jym 	uint8_t		at_cdb[ATIO2_CDBLEN];	/* received CDB */
   2022  1.52.12.1     jym 	uint32_t	at_datalen;		/* allocated data len */
   2023  1.52.12.1     jym 	uint16_t	at_scclun;		/* SCC Lun or reserved */
   2024  1.52.12.1     jym 	uint16_t	at_wwpn[4];		/* WWPN of initiator */
   2025  1.52.12.1     jym 	uint16_t	at_reserved2[6];
   2026  1.52.12.1     jym 	uint16_t	at_oxid;
   2027  1.52.12.1     jym } at2_entry_t;
   2028  1.52.12.1     jym 
   2029  1.52.12.1     jym typedef struct {
   2030  1.52.12.1     jym 	isphdr_t	at_header;
   2031  1.52.12.1     jym 	uint32_t	at_reserved;
   2032  1.52.12.1     jym 	uint16_t	at_iid;		/* initiator */
   2033  1.52.12.1     jym 	uint16_t	at_rxid; 	/* response ID */
   2034  1.52.12.1     jym 	uint16_t	at_flags;
   2035  1.52.12.1     jym 	uint16_t	at_status;	/* firmware status */
   2036  1.52.12.1     jym 	uint8_t		at_crn;		/* command reference number */
   2037  1.52.12.1     jym 	uint8_t		at_taskcodes;
   2038  1.52.12.1     jym 	uint8_t		at_taskflags;
   2039  1.52.12.1     jym 	uint8_t		at_execodes;
   2040  1.52.12.1     jym 	uint8_t		at_cdb[ATIO2_CDBLEN];	/* received CDB */
   2041  1.52.12.1     jym 	uint32_t	at_datalen;		/* allocated data len */
   2042  1.52.12.1     jym 	uint16_t	at_scclun;		/* SCC Lun or reserved */
   2043  1.52.12.1     jym 	uint16_t	at_wwpn[4];		/* WWPN of initiator */
   2044  1.52.12.1     jym 	uint16_t	at_reserved2[6];
   2045  1.52.12.1     jym 	uint16_t	at_oxid;
   2046  1.52.12.1     jym } at2e_entry_t;
   2047  1.52.12.1     jym 
   2048  1.52.12.1     jym #define	ATIO2_WWPN_OFFSET	0x2A
   2049  1.52.12.1     jym #define	ATIO2_OXID_OFFSET	0x3E
   2050  1.52.12.1     jym 
   2051  1.52.12.1     jym #define	ATIO2_TC_ATTR_MASK	0x7
   2052  1.52.12.1     jym #define	ATIO2_TC_ATTR_SIMPLEQ	0
   2053  1.52.12.1     jym #define	ATIO2_TC_ATTR_HEADOFQ	1
   2054  1.52.12.1     jym #define	ATIO2_TC_ATTR_ORDERED	2
   2055  1.52.12.1     jym #define	ATIO2_TC_ATTR_ACAQ	4
   2056  1.52.12.1     jym #define	ATIO2_TC_ATTR_UNTAGGED	5
   2057  1.52.12.1     jym 
   2058  1.52.12.1     jym #define	ATIO2_EX_WRITE		0x1
   2059  1.52.12.1     jym #define	ATIO2_EX_READ		0x2
   2060  1.52.12.1     jym /*
   2061  1.52.12.1     jym  * Macros to create and fetch and test concatenated handle and tag value macros
   2062  1.52.12.1     jym  */
   2063  1.52.12.1     jym #define	AT2_MAKE_TAGID(tid, bus, inst, aep)				\
   2064  1.52.12.1     jym 	tid = aep->at_rxid;						\
   2065  1.52.12.1     jym 	tid |= (((uint64_t)inst) << 32);				\
   2066  1.52.12.1     jym 	tid |= (((uint64_t)bus) << 48)
   2067  1.52.12.1     jym 
   2068  1.52.12.1     jym #define	CT2_MAKE_TAGID(tid, bus, inst, ct)				\
   2069  1.52.12.1     jym 	tid = ct->ct_rxid;						\
   2070  1.52.12.1     jym 	tid |= (((uint64_t)inst) << 32);				\
   2071  1.52.12.1     jym 	tid |= (((uint64_t)(bus & 0xff)) << 48)
   2072  1.52.12.1     jym 
   2073  1.52.12.1     jym #define	AT2_HAS_TAG(val)	1
   2074  1.52.12.1     jym #define	AT2_GET_TAG(val)	((val) & 0xffffffff)
   2075  1.52.12.1     jym #define	AT2_GET_INST(val)	(((val) >> 32) & 0xffff)
   2076  1.52.12.1     jym #define	AT2_GET_HANDLE		AT2_GET_TAG
   2077  1.52.12.1     jym #define	AT2_GET_BUS(val)	(((val) >> 48) & 0xff)
   2078  1.52.12.1     jym 
   2079  1.52.12.1     jym #define	FC_HAS_TAG	AT2_HAS_TAG
   2080  1.52.12.1     jym #define	FC_GET_TAG	AT2_GET_TAG
   2081  1.52.12.1     jym #define	FC_GET_INST	AT2_GET_INST
   2082  1.52.12.1     jym #define	FC_GET_HANDLE	AT2_GET_HANDLE
   2083  1.52.12.1     jym 
   2084  1.52.12.1     jym #define	IN_FC_MAKE_TAGID(tid, bus, inst, seqid)				\
   2085  1.52.12.1     jym 	tid = seqid;							\
   2086  1.52.12.1     jym 	tid |= (((uint64_t)inst) << 32);				\
   2087  1.52.12.1     jym 	tid |= (((uint64_t)(bus & 0xff)) << 48)
   2088  1.52.12.1     jym 
   2089  1.52.12.1     jym #define	FC_TAG_INSERT_INST(tid, inst)					\
   2090  1.52.12.1     jym 	tid &= ~0x0000ffff00000000ull;					\
   2091  1.52.12.1     jym 	tid |= (((uint64_t)inst) << 32)
   2092  1.52.12.1     jym 
   2093  1.52.12.1     jym /*
   2094  1.52.12.1     jym  * 24XX ATIO Definition
   2095  1.52.12.1     jym  *
   2096  1.52.12.1     jym  * This is *quite* different from other entry types.
   2097  1.52.12.1     jym  * First of all, it has its own queue it comes in on.
   2098  1.52.12.1     jym  *
   2099  1.52.12.1     jym  * Secondly, it doesn't have a normal header.
   2100  1.52.12.1     jym  *
   2101  1.52.12.1     jym  * Thirdly, it's just a passthru of the FCP CMND IU
   2102  1.52.12.1     jym  * which is recorded in big endian mode.
   2103  1.52.12.1     jym  */
   2104  1.52.12.1     jym typedef struct {
   2105  1.52.12.1     jym 	uint8_t		at_type;
   2106  1.52.12.1     jym 	uint8_t		at_count;
   2107  1.52.12.1     jym 	/*
   2108  1.52.12.1     jym 	 * Task attribute in high four bits,
   2109  1.52.12.1     jym 	 * the rest is the FCP CMND IU Length.
   2110  1.52.12.1     jym 	 * NB: the command can extend past the
   2111  1.52.12.1     jym 	 * length for a single queue entry.
   2112  1.52.12.1     jym 	 */
   2113  1.52.12.1     jym 	uint16_t	at_ta_len;
   2114  1.52.12.1     jym 	uint32_t	at_rxid;
   2115  1.52.12.1     jym 	fc_hdr_t	at_hdr;
   2116  1.52.12.1     jym 	fcp_cmnd_iu_t	at_cmnd;
   2117  1.52.12.1     jym } at7_entry_t;
   2118  1.52.12.1     jym #define	AT7_NORESRC_RXID	0xffffffff
   2119  1.52.12.1     jym 
   2120  1.52.12.1     jym 
   2121  1.52.12.1     jym /*
   2122  1.52.12.1     jym  * Continue Target I/O Entry structure
   2123  1.52.12.1     jym  * Request from driver. The response from the
   2124  1.52.12.1     jym  * ISP firmware is the same except that the last 18
   2125  1.52.12.1     jym  * bytes are overwritten by suggested sense data if
   2126  1.52.12.1     jym  * the 'autosense valid' bit is set in the status byte.
   2127  1.52.12.1     jym  */
   2128  1.52.12.1     jym typedef struct {
   2129  1.52.12.1     jym 	isphdr_t	ct_header;
   2130  1.52.12.1     jym 	uint16_t	ct_syshandle;
   2131  1.52.12.1     jym 	uint16_t	ct_fwhandle;	/* required by f/w */
   2132  1.52.12.1     jym 	uint8_t		ct_lun;	/* lun */
   2133  1.52.12.1     jym 	uint8_t		ct_iid;	/* initiator id */
   2134  1.52.12.1     jym 	uint8_t		ct_reserved2;
   2135  1.52.12.1     jym 	uint8_t		ct_tgt;	/* our target id */
   2136  1.52.12.1     jym 	uint32_t	ct_flags;
   2137  1.52.12.1     jym 	uint8_t 	ct_status;	/* isp status */
   2138  1.52.12.1     jym 	uint8_t 	ct_scsi_status;	/* scsi status */
   2139  1.52.12.1     jym 	uint8_t 	ct_tag_val;	/* tag value */
   2140  1.52.12.1     jym 	uint8_t 	ct_tag_type;	/* tag type */
   2141  1.52.12.1     jym 	uint32_t	ct_xfrlen;	/* transfer length */
   2142  1.52.12.1     jym 	int32_t		ct_resid;	/* residual length */
   2143  1.52.12.1     jym 	uint16_t	ct_timeout;
   2144  1.52.12.1     jym 	uint16_t	ct_seg_count;
   2145  1.52.12.1     jym 	ispds_t		ct_dataseg[ISP_RQDSEG];
   2146  1.52.12.1     jym } ct_entry_t;
   2147  1.52.12.1     jym 
   2148  1.52.12.1     jym /*
   2149  1.52.12.1     jym  * For some of the dual port SCSI adapters, port (bus #) is reported
   2150  1.52.12.1     jym  * in the MSbit of ct_iid. Bit fields are a bit too awkward here.
   2151  1.52.12.1     jym  *
   2152  1.52.12.1     jym  * Note that this does not apply to FC adapters at all which can and
   2153  1.52.12.1     jym  * do report IIDs between 0x81 && 0xfe (or 0x7ff) which represent devices
   2154  1.52.12.1     jym  * that have logged in across a SCSI fabric.
   2155  1.52.12.1     jym  */
   2156  1.52.12.1     jym #define	GET_IID_VAL(x)		(x & 0x3f)
   2157  1.52.12.1     jym #define	GET_BUS_VAL(x)		((x >> 7) & 0x1)
   2158  1.52.12.1     jym #define	SET_IID_VAL(y, x)	y = ((y & ~0x3f) | (x & 0x3f))
   2159  1.52.12.1     jym #define	SET_BUS_VAL(y, x)	y = ((y & 0x3f) | ((x & 0x1) << 7))
   2160  1.52.12.1     jym 
   2161  1.52.12.1     jym /*
   2162  1.52.12.1     jym  * ct_flags values
   2163  1.52.12.1     jym  */
   2164  1.52.12.1     jym #define CT_TQAE		0x00000002	/* bit  1, Tagged Queue Action enable */
   2165  1.52.12.1     jym #define CT_DATA_IN	0x00000040	/* bits 6&7, Data direction */
   2166  1.52.12.1     jym #define CT_DATA_OUT	0x00000080	/* bits 6&7, Data direction */
   2167  1.52.12.1     jym #define CT_NO_DATA	0x000000C0	/* bits 6&7, Data direction */
   2168  1.52.12.1     jym #define	CT_CCINCR	0x00000100	/* bit 8, autoincrement atio count */
   2169  1.52.12.1     jym #define CT_DATAMASK	0x000000C0	/* bits 6&7, Data direction */
   2170  1.52.12.1     jym #define	CT_INISYNCWIDE	0x00004000	/* bit 14, Do Sync/Wide Negotiation */
   2171  1.52.12.1     jym #define CT_NODISC	0x00008000	/* bit 15, Disconnects disabled */
   2172  1.52.12.1     jym #define CT_DSDP		0x01000000	/* bit 24, Disable Save Data Pointers */
   2173  1.52.12.1     jym #define CT_SENDRDP	0x04000000	/* bit 26, Send Restore Pointers msg */
   2174  1.52.12.1     jym #define CT_SENDSTATUS	0x80000000	/* bit 31, Send SCSI status byte */
   2175  1.52.12.1     jym 
   2176  1.52.12.1     jym /*
   2177  1.52.12.1     jym  * ct_status values
   2178  1.52.12.1     jym  * - set by the firmware when it returns the CTIO
   2179  1.52.12.1     jym  */
   2180  1.52.12.1     jym #define CT_OK		0x01	/* completed without error */
   2181  1.52.12.1     jym #define CT_ABORTED	0x02	/* aborted by host */
   2182  1.52.12.1     jym #define CT_ERR		0x04	/* see sense data for error */
   2183  1.52.12.1     jym #define CT_INVAL	0x06	/* request for disabled lun */
   2184  1.52.12.1     jym #define CT_NOPATH	0x07	/* invalid ITL nexus */
   2185  1.52.12.1     jym #define	CT_INVRXID	0x08	/* (FC only) Invalid RX_ID */
   2186  1.52.12.1     jym #define	CT_DATA_OVER	0x09	/* (FC only) Data Overrun */
   2187  1.52.12.1     jym #define CT_RSELTMO	0x0A	/* reselection timeout after 2 tries */
   2188  1.52.12.1     jym #define CT_TIMEOUT	0x0B	/* timed out */
   2189  1.52.12.1     jym #define CT_RESET	0x0E	/* SCSI Bus Reset occurred */
   2190  1.52.12.1     jym #define	CT_PARITY	0x0F	/* Uncorrectable Parity Error */
   2191  1.52.12.1     jym #define	CT_BUS_ERROR	0x10	/* (FC Only) DMA PCI Error */
   2192  1.52.12.1     jym #define	CT_PANIC	0x13	/* Unrecoverable Error */
   2193  1.52.12.1     jym #define CT_PHASE_ERROR	0x14	/* Bus phase sequence error */
   2194  1.52.12.1     jym #define	CT_DATA_UNDER	0x15	/* (FC only) Data Underrun */
   2195  1.52.12.1     jym #define CT_BDR_MSG	0x17	/* Bus Device Reset msg received */
   2196  1.52.12.1     jym #define CT_TERMINATED	0x19	/* due to Terminate Transfer mbox cmd */
   2197  1.52.12.1     jym #define	CT_PORTUNAVAIL	0x28	/* port not available */
   2198  1.52.12.1     jym #define	CT_LOGOUT	0x29	/* port logout */
   2199  1.52.12.1     jym #define	CT_PORTCHANGED	0x2A	/* port changed */
   2200  1.52.12.1     jym #define	CT_IDE		0x33	/* Initiator Detected Error */
   2201  1.52.12.1     jym #define CT_NOACK	0x35	/* Outstanding Immed. Notify. entry */
   2202  1.52.12.1     jym #define	CT_SRR		0x45	/* SRR Received */
   2203  1.52.12.1     jym #define	CT_LUN_RESET	0x48	/* Lun Reset Received */
   2204  1.52.12.1     jym 
   2205  1.52.12.1     jym #define	CT_HBA_RESET	0xffff	/* pseudo error - command destroyed by HBA reset*/
   2206  1.52.12.1     jym 
   2207  1.52.12.1     jym /*
   2208  1.52.12.1     jym  * When the firmware returns a CTIO entry, it may overwrite the last
   2209  1.52.12.1     jym  * part of the structure with sense data. This starts at offset 0x2E
   2210  1.52.12.1     jym  * into the entry, which is in the middle of ct_dataseg[1]. Rather
   2211  1.52.12.1     jym  * than define a new struct for this, I'm just using the sense data
   2212  1.52.12.1     jym  * offset.
   2213  1.52.12.1     jym  */
   2214  1.52.12.1     jym #define CTIO_SENSE_OFFSET	0x2E
   2215  1.52.12.1     jym 
   2216  1.52.12.1     jym /*
   2217  1.52.12.1     jym  * Entry length in u_longs. All entries are the same size so
   2218  1.52.12.1     jym  * any one will do as the numerator.
   2219  1.52.12.1     jym  */
   2220  1.52.12.1     jym #define UINT32_ENTRY_SIZE	(sizeof(at_entry_t)/sizeof(uint32_t))
   2221  1.52.12.1     jym 
   2222  1.52.12.1     jym /*
   2223  1.52.12.1     jym  * QLA2100 CTIO (type 2) entry
   2224  1.52.12.1     jym  */
   2225  1.52.12.1     jym #define	MAXRESPLEN	26
   2226  1.52.12.1     jym typedef struct {
   2227  1.52.12.1     jym 	isphdr_t	ct_header;
   2228  1.52.12.1     jym 	uint32_t	ct_syshandle;
   2229  1.52.12.1     jym 	uint8_t		ct_lun;		/* lun */
   2230  1.52.12.1     jym 	uint8_t		ct_iid;		/* initiator id */
   2231  1.52.12.1     jym 	uint16_t	ct_rxid;	/* response ID */
   2232  1.52.12.1     jym 	uint16_t	ct_flags;
   2233  1.52.12.1     jym 	uint16_t 	ct_status;	/* isp status */
   2234  1.52.12.1     jym 	uint16_t	ct_timeout;
   2235  1.52.12.1     jym 	uint16_t	ct_seg_count;
   2236  1.52.12.1     jym 	uint32_t	ct_reloff;	/* relative offset */
   2237  1.52.12.1     jym 	int32_t		ct_resid;	/* residual length */
   2238  1.52.12.1     jym 	union {
   2239  1.52.12.1     jym 		/*
   2240  1.52.12.1     jym 		 * The three different modes that the target driver
   2241  1.52.12.1     jym 		 * can set the CTIO{2,3,4} up as.
   2242  1.52.12.1     jym 		 *
   2243  1.52.12.1     jym 		 * The first is for sending FCP_DATA_IUs as well as
   2244  1.52.12.1     jym 		 * (optionally) sending a terminal SCSI status FCP_RSP_IU.
   2245  1.52.12.1     jym 		 *
   2246  1.52.12.1     jym 		 * The second is for sending SCSI sense data in an FCP_RSP_IU.
   2247  1.52.12.1     jym 		 * Note that no FCP_DATA_IUs will be sent.
   2248  1.52.12.1     jym 		 *
   2249  1.52.12.1     jym 		 * The third is for sending FCP_RSP_IUs as built specifically
   2250  1.52.12.1     jym 		 * in system memory as located by the isp_dataseg.
   2251  1.52.12.1     jym 		 */
   2252  1.52.12.1     jym 		struct {
   2253  1.52.12.1     jym 			uint32_t _reserved;
   2254  1.52.12.1     jym 			uint16_t _reserved2;
   2255  1.52.12.1     jym 			uint16_t ct_scsi_status;
   2256  1.52.12.1     jym 			uint32_t ct_xfrlen;
   2257  1.52.12.1     jym 			union {
   2258  1.52.12.1     jym 				ispds_t ct_dataseg[ISP_RQDSEG_T2];
   2259  1.52.12.1     jym 				ispds64_t ct_dataseg64[ISP_RQDSEG_T3];
   2260  1.52.12.1     jym 				ispdslist_t ct_dslist;
   2261  1.52.12.1     jym 			} u;
   2262  1.52.12.1     jym 		} m0;
   2263  1.52.12.1     jym 		struct {
   2264  1.52.12.1     jym 			uint16_t _reserved;
   2265  1.52.12.1     jym 			uint16_t _reserved2;
   2266  1.52.12.1     jym 			uint16_t ct_senselen;
   2267  1.52.12.1     jym 			uint16_t ct_scsi_status;
   2268  1.52.12.1     jym 			uint16_t ct_resplen;
   2269  1.52.12.1     jym 			uint8_t  ct_resp[MAXRESPLEN];
   2270  1.52.12.1     jym 		} m1;
   2271  1.52.12.1     jym 		struct {
   2272  1.52.12.1     jym 			uint32_t _reserved;
   2273  1.52.12.1     jym 			uint16_t _reserved2;
   2274  1.52.12.1     jym 			uint16_t _reserved3;
   2275  1.52.12.1     jym 			uint32_t ct_datalen;
   2276  1.52.12.1     jym 			ispds_t ct_fcp_rsp_iudata;
   2277  1.52.12.1     jym 		} m2;
   2278  1.52.12.1     jym 	} rsp;
   2279  1.52.12.1     jym } ct2_entry_t;
   2280  1.52.12.1     jym 
   2281  1.52.12.1     jym typedef struct {
   2282  1.52.12.1     jym 	isphdr_t	ct_header;
   2283  1.52.12.1     jym 	uint32_t	ct_syshandle;
   2284  1.52.12.1     jym 	uint16_t	ct_iid;		/* initiator id */
   2285  1.52.12.1     jym 	uint16_t	ct_rxid;	/* response ID */
   2286  1.52.12.1     jym 	uint16_t	ct_flags;
   2287  1.52.12.1     jym 	uint16_t 	ct_status;	/* isp status */
   2288  1.52.12.1     jym 	uint16_t	ct_timeout;
   2289  1.52.12.1     jym 	uint16_t	ct_seg_count;
   2290  1.52.12.1     jym 	uint32_t	ct_reloff;	/* relative offset */
   2291  1.52.12.1     jym 	int32_t		ct_resid;	/* residual length */
   2292  1.52.12.1     jym 	union {
   2293  1.52.12.1     jym 		struct {
   2294  1.52.12.1     jym 			uint32_t _reserved;
   2295  1.52.12.1     jym 			uint16_t _reserved2;
   2296  1.52.12.1     jym 			uint16_t ct_scsi_status;
   2297  1.52.12.1     jym 			uint32_t ct_xfrlen;
   2298  1.52.12.1     jym 			union {
   2299  1.52.12.1     jym 				ispds_t ct_dataseg[ISP_RQDSEG_T2];
   2300  1.52.12.1     jym 				ispds64_t ct_dataseg64[ISP_RQDSEG_T3];
   2301  1.52.12.1     jym 				ispdslist_t ct_dslist;
   2302  1.52.12.1     jym 			} u;
   2303  1.52.12.1     jym 		} m0;
   2304  1.52.12.1     jym 		struct {
   2305  1.52.12.1     jym 			uint16_t _reserved;
   2306  1.52.12.1     jym 			uint16_t _reserved2;
   2307  1.52.12.1     jym 			uint16_t ct_senselen;
   2308  1.52.12.1     jym 			uint16_t ct_scsi_status;
   2309  1.52.12.1     jym 			uint16_t ct_resplen;
   2310  1.52.12.1     jym 			uint8_t  ct_resp[MAXRESPLEN];
   2311  1.52.12.1     jym 		} m1;
   2312  1.52.12.1     jym 		struct {
   2313  1.52.12.1     jym 			uint32_t _reserved;
   2314  1.52.12.1     jym 			uint16_t _reserved2;
   2315  1.52.12.1     jym 			uint16_t _reserved3;
   2316  1.52.12.1     jym 			uint32_t ct_datalen;
   2317  1.52.12.1     jym 			ispds_t ct_fcp_rsp_iudata;
   2318  1.52.12.1     jym 		} m2;
   2319  1.52.12.1     jym 	} rsp;
   2320  1.52.12.1     jym } ct2e_entry_t;
   2321  1.52.12.1     jym 
   2322  1.52.12.1     jym /*
   2323  1.52.12.1     jym  * ct_flags values for CTIO2
   2324  1.52.12.1     jym  */
   2325  1.52.12.1     jym #define	CT2_FLAG_MODE0	0x0000
   2326  1.52.12.1     jym #define	CT2_FLAG_MODE1	0x0001
   2327  1.52.12.1     jym #define	CT2_FLAG_MODE2	0x0002
   2328  1.52.12.1     jym #define		CT2_FLAG_MMASK	0x0003
   2329  1.52.12.1     jym #define CT2_DATA_IN	0x0040
   2330  1.52.12.1     jym #define CT2_DATA_OUT	0x0080
   2331  1.52.12.1     jym #define CT2_NO_DATA	0x00C0
   2332  1.52.12.1     jym #define 	CT2_DATAMASK	0x00C0
   2333  1.52.12.1     jym #define	CT2_CCINCR	0x0100
   2334  1.52.12.1     jym #define	CT2_FASTPOST	0x0200
   2335  1.52.12.1     jym #define	CT2_CONFIRM	0x2000
   2336  1.52.12.1     jym #define	CT2_TERMINATE	0x4000
   2337  1.52.12.1     jym #define CT2_SENDSTATUS	0x8000
   2338  1.52.12.1     jym 
   2339  1.52.12.1     jym /*
   2340  1.52.12.1     jym  * ct_status values are (mostly) the same as that for ct_entry.
   2341  1.52.12.1     jym  */
   2342  1.52.12.1     jym 
   2343  1.52.12.1     jym /*
   2344  1.52.12.1     jym  * ct_scsi_status values- the low 8 bits are the normal SCSI status
   2345  1.52.12.1     jym  * we know and love. The upper 8 bits are validity markers for FCP_RSP_IU
   2346  1.52.12.1     jym  * fields.
   2347  1.52.12.1     jym  */
   2348  1.52.12.1     jym #define	CT2_RSPLEN_VALID	0x0100
   2349  1.52.12.1     jym #define	CT2_SNSLEN_VALID	0x0200
   2350  1.52.12.1     jym #define	CT2_DATA_OVER		0x0400
   2351  1.52.12.1     jym #define	CT2_DATA_UNDER		0x0800
   2352  1.52.12.1     jym 
   2353  1.52.12.1     jym /*
   2354  1.52.12.1     jym  * ISP24XX CTIO
   2355  1.52.12.1     jym  */
   2356  1.52.12.1     jym #define	MAXRESPLEN_24XX	24
   2357  1.52.12.1     jym typedef struct {
   2358  1.52.12.1     jym 	isphdr_t	ct_header;
   2359  1.52.12.1     jym 	uint32_t	ct_syshandle;
   2360  1.52.12.1     jym 	uint16_t	ct_nphdl;	/* status on returned CTIOs */
   2361  1.52.12.1     jym 	uint16_t	ct_timeout;
   2362  1.52.12.1     jym 	uint16_t	ct_seg_count;
   2363  1.52.12.1     jym 	uint8_t		ct_vpidx;
   2364  1.52.12.1     jym 	uint8_t		ct_xflags;
   2365  1.52.12.1     jym 	uint16_t	ct_iid_lo;	/* low 16 bits of portid */
   2366  1.52.12.1     jym 	uint8_t		ct_iid_hi;	/* hi 8 bits of portid */
   2367  1.52.12.1     jym 	uint8_t		ct_reserved;
   2368  1.52.12.1     jym 	uint32_t	ct_rxid;
   2369  1.52.12.1     jym 	uint16_t	ct_senselen;	/* mode 1 only */
   2370  1.52.12.1     jym 	uint16_t	ct_flags;
   2371  1.52.12.1     jym 	int32_t		ct_resid;	/* residual length */
   2372  1.52.12.1     jym 	uint16_t	ct_oxid;
   2373  1.52.12.1     jym 	uint16_t	ct_scsi_status;	/* modes 0 && 1 only */
   2374  1.52.12.1     jym 	union {
   2375  1.52.12.1     jym 		struct {
   2376  1.52.12.1     jym 			uint32_t	reloff;
   2377  1.52.12.1     jym 			uint32_t	reserved0;
   2378  1.52.12.1     jym 			uint32_t	ct_xfrlen;
   2379  1.52.12.1     jym 			uint32_t	reserved1;
   2380  1.52.12.1     jym 			ispds64_t	ds;
   2381  1.52.12.1     jym 		} m0;
   2382  1.52.12.1     jym 		struct {
   2383  1.52.12.1     jym 			uint16_t ct_resplen;
   2384  1.52.12.1     jym 			uint16_t reserved;
   2385  1.52.12.1     jym 			uint8_t  ct_resp[MAXRESPLEN_24XX];
   2386  1.52.12.1     jym 		} m1;
   2387  1.52.12.1     jym 		struct {
   2388  1.52.12.1     jym 			uint32_t reserved0;
   2389  1.52.12.1     jym 			uint32_t ct_datalen;
   2390  1.52.12.1     jym 			uint32_t reserved1;
   2391  1.52.12.1     jym 			ispds64_t ct_fcp_rsp_iudata;
   2392  1.52.12.1     jym 		} m2;
   2393  1.52.12.1     jym 	} rsp;
   2394  1.52.12.1     jym } ct7_entry_t;
   2395  1.52.12.1     jym 
   2396  1.52.12.1     jym /*
   2397  1.52.12.1     jym  * ct_flags values for CTIO7
   2398  1.52.12.1     jym  */
   2399  1.52.12.1     jym #define CT7_DATA_IN	0x0002
   2400  1.52.12.1     jym #define CT7_DATA_OUT	0x0001
   2401  1.52.12.1     jym #define CT7_NO_DATA	0x0000
   2402  1.52.12.1     jym #define 	CT7_DATAMASK	0x003
   2403  1.52.12.1     jym #define	CT7_DSD_ENABLE	0x0004
   2404  1.52.12.1     jym #define	CT7_CONF_STSFD	0x0010
   2405  1.52.12.1     jym #define	CT7_EXPLCT_CONF	0x0020
   2406  1.52.12.1     jym #define	CT7_FLAG_MODE0	0x0000
   2407  1.52.12.1     jym #define	CT7_FLAG_MODE1	0x0040
   2408  1.52.12.1     jym #define	CT7_FLAG_MODE2	0x0080
   2409  1.52.12.1     jym #define		CT7_FLAG_MMASK	0x00C0
   2410  1.52.12.1     jym #define	CT7_NOACK	0x0100
   2411  1.52.12.1     jym #define	CT7_TASK_ATTR_SHIFT	9
   2412  1.52.12.1     jym #define	CT7_CONFIRM	0x2000
   2413  1.52.12.1     jym #define	CT7_TERMINATE	0x4000
   2414  1.52.12.1     jym #define CT7_SENDSTATUS	0x8000
   2415  1.52.12.1     jym 
   2416  1.52.12.1     jym /*
   2417  1.52.12.1     jym  * Type 7 CTIO status codes
   2418  1.52.12.1     jym  */
   2419  1.52.12.1     jym #define CT7_OK		0x01	/* completed without error */
   2420  1.52.12.1     jym #define CT7_ABORTED	0x02	/* aborted by host */
   2421  1.52.12.1     jym #define CT7_ERR		0x04	/* see sense data for error */
   2422  1.52.12.1     jym #define CT7_INVAL	0x06	/* request for disabled lun */
   2423  1.52.12.1     jym #define	CT7_INVRXID	0x08	/* Invalid RX_ID */
   2424  1.52.12.1     jym #define	CT7_DATA_OVER	0x09	/* Data Overrun */
   2425  1.52.12.1     jym #define CT7_TIMEOUT	0x0B	/* timed out */
   2426  1.52.12.1     jym #define CT7_RESET	0x0E	/* LIP Rset Received */
   2427  1.52.12.1     jym #define	CT7_BUS_ERROR	0x10	/* DMA PCI Error */
   2428  1.52.12.1     jym #define	CT7_REASSY_ERR	0x11	/* DMA reassembly error */
   2429  1.52.12.1     jym #define	CT7_DATA_UNDER	0x15	/* Data Underrun */
   2430  1.52.12.1     jym #define	CT7_PORTUNAVAIL	0x28	/* port not available */
   2431  1.52.12.1     jym #define	CT7_LOGOUT	0x29	/* port logout */
   2432  1.52.12.1     jym #define	CT7_PORTCHANGED	0x2A	/* port changed */
   2433  1.52.12.1     jym #define	CT7_SRR		0x45	/* SRR Received */
   2434  1.52.12.1     jym 
   2435  1.52.12.1     jym /*
   2436  1.52.12.1     jym  * Other 24XX related target IOCBs
   2437  1.52.12.1     jym  */
   2438  1.52.12.1     jym 
   2439  1.52.12.1     jym /*
   2440  1.52.12.1     jym  * ABTS Received
   2441  1.52.12.1     jym  */
   2442  1.52.12.1     jym typedef struct {
   2443  1.52.12.1     jym 	isphdr_t	abts_header;
   2444  1.52.12.1     jym 	uint8_t		abts_reserved0[6];
   2445  1.52.12.1     jym 	uint16_t	abts_nphdl;
   2446  1.52.12.1     jym 	uint16_t	abts_reserved1;
   2447  1.52.12.1     jym 	uint16_t	abts_sof;
   2448  1.52.12.1     jym 	uint32_t	abts_rxid_abts;
   2449  1.52.12.1     jym 	uint16_t	abts_did_lo;
   2450  1.52.12.1     jym 	uint8_t		abts_did_hi;
   2451  1.52.12.1     jym 	uint8_t		abts_r_ctl;
   2452  1.52.12.1     jym 	uint16_t	abts_sid_lo;
   2453  1.52.12.1     jym 	uint8_t		abts_sid_hi;
   2454  1.52.12.1     jym 	uint8_t		abts_cs_ctl;
   2455  1.52.12.1     jym 	uint16_t	abts_fs_ctl;
   2456  1.52.12.1     jym 	uint8_t		abts_f_ctl;
   2457  1.52.12.1     jym 	uint8_t		abts_type;
   2458  1.52.12.1     jym 	uint16_t	abts_seq_cnt;
   2459  1.52.12.1     jym 	uint8_t		abts_df_ctl;
   2460  1.52.12.1     jym 	uint8_t		abts_seq_id;
   2461  1.52.12.1     jym 	uint16_t	abts_rx_id;
   2462  1.52.12.1     jym 	uint16_t	abts_ox_id;
   2463  1.52.12.1     jym 	uint32_t	abts_param;
   2464  1.52.12.1     jym 	uint8_t		abts_reserved2[16];
   2465  1.52.12.1     jym 	uint32_t	abts_rxid_task;
   2466  1.52.12.1     jym } abts_t;
   2467  1.52.12.1     jym 
   2468  1.52.12.1     jym typedef struct {
   2469  1.52.12.1     jym 	isphdr_t	abts_rsp_header;
   2470  1.52.12.1     jym 	uint32_t	abts_rsp_handle;
   2471  1.52.12.1     jym 	uint16_t	abts_rsp_status;
   2472  1.52.12.1     jym 	uint16_t	abts_rsp_nphdl;
   2473  1.52.12.1     jym 	uint16_t	abts_rsp_ctl_flags;
   2474  1.52.12.1     jym 	uint16_t	abts_rsp_sof;
   2475  1.52.12.1     jym 	uint32_t	abts_rsp_rxid_abts;
   2476  1.52.12.1     jym 	uint16_t	abts_rsp_did_lo;
   2477  1.52.12.1     jym 	uint8_t		abts_rsp_did_hi;
   2478  1.52.12.1     jym 	uint8_t		abts_rsp_r_ctl;
   2479  1.52.12.1     jym 	uint16_t	abts_rsp_sid_lo;
   2480  1.52.12.1     jym 	uint8_t		abts_rsp_sid_hi;
   2481  1.52.12.1     jym 	uint8_t		abts_rsp_cs_ctl;
   2482  1.52.12.1     jym 	uint16_t	abts_rsp_f_ctl_lo;
   2483  1.52.12.1     jym 	uint8_t		abts_rsp_f_ctl_hi;
   2484  1.52.12.1     jym 	uint8_t		abts_rsp_type;
   2485  1.52.12.1     jym 	uint16_t	abts_rsp_seq_cnt;
   2486  1.52.12.1     jym 	uint8_t		abts_rsp_df_ctl;
   2487  1.52.12.1     jym 	uint8_t		abts_rsp_seq_id;
   2488  1.52.12.1     jym 	uint16_t	abts_rsp_rx_id;
   2489  1.52.12.1     jym 	uint16_t	abts_rsp_ox_id;
   2490  1.52.12.1     jym 	uint32_t	abts_rsp_param;
   2491  1.52.12.1     jym 	union {
   2492  1.52.12.1     jym 		struct {
   2493  1.52.12.1     jym 			uint16_t reserved;
   2494  1.52.12.1     jym 			uint8_t	last_seq_id;
   2495  1.52.12.1     jym 			uint8_t seq_id_valid;
   2496  1.52.12.1     jym 			uint16_t aborted_rx_id;
   2497  1.52.12.1     jym 			uint16_t aborted_ox_id;
   2498  1.52.12.1     jym 			uint16_t high_seq_cnt;
   2499  1.52.12.1     jym 			uint16_t low_seq_cnt;
   2500  1.52.12.1     jym 			uint8_t reserved2[4];
   2501  1.52.12.1     jym 		} ba_acc;
   2502  1.52.12.1     jym 		struct {
   2503  1.52.12.1     jym 			uint8_t vendor_unique;
   2504  1.52.12.1     jym 			uint8_t	explanation;
   2505  1.52.12.1     jym 			uint8_t reason;
   2506  1.52.12.1     jym 			uint8_t reserved;
   2507  1.52.12.1     jym 			uint8_t reserved2[12];
   2508  1.52.12.1     jym 		} ba_rjt;
   2509  1.52.12.1     jym 		struct {
   2510  1.52.12.1     jym 			uint8_t reserved[8];
   2511  1.52.12.1     jym 			uint32_t subcode1;
   2512  1.52.12.1     jym 			uint32_t subcode2;
   2513  1.52.12.1     jym 		} rsp;
   2514  1.52.12.1     jym 		uint8_t reserved[16];
   2515  1.52.12.1     jym 	} abts_rsp_payload;
   2516  1.52.12.1     jym 	uint32_t	abts_rsp_rxid_task;
   2517  1.52.12.1     jym } abts_rsp_t;
   2518  1.52.12.1     jym 
   2519  1.52.12.1     jym /* terminate this ABTS exchange */
   2520  1.52.12.1     jym #define	ISP24XX_ABTS_RSP_TERMINATE	0x01
   2521  1.52.12.1     jym 
   2522  1.52.12.1     jym #define	ISP24XX_ABTS_RSP_COMPLETE	0x00
   2523  1.52.12.1     jym #define	ISP24XX_ABTS_RSP_RESET		0x04
   2524  1.52.12.1     jym #define	ISP24XX_ABTS_RSP_ABORTED	0x05
   2525  1.52.12.1     jym #define	ISP24XX_ABTS_RSP_TIMEOUT	0x06
   2526  1.52.12.1     jym #define	ISP24XX_ABTS_RSP_INVXID		0x08
   2527  1.52.12.1     jym #define	ISP24XX_ABTS_RSP_LOGOUT		0x29
   2528  1.52.12.1     jym #define	ISP24XX_ABTS_RSP_SUBCODE	0x31
   2529  1.52.12.1     jym 
   2530  1.52.12.1     jym #define	ISP24XX_NO_TASK			0xffffffff
   2531  1.52.12.1     jym 
   2532  1.52.12.1     jym /*
   2533  1.52.12.1     jym  * Miscellaneous
   2534  1.52.12.1     jym  *
   2535  1.52.12.1     jym  * These are the limits of the number of dma segments we
   2536  1.52.12.1     jym  * can deal with based not on the size of the segment counter
   2537  1.52.12.1     jym  * (which is 16 bits), but on the size of the number of
   2538  1.52.12.1     jym  * queue entries field (which is 8 bits). We assume no
   2539  1.52.12.1     jym  * segments in the first queue entry, so we can either
   2540  1.52.12.1     jym  * have 7 dma segments per continuation entry or 5
   2541  1.52.12.1     jym  * (for 64 bit dma).. multiplying out by 254....
   2542  1.52.12.1     jym  */
   2543  1.52.12.1     jym #define	ISP_NSEG_MAX	1778
   2544  1.52.12.1     jym #define	ISP_NSEG64_MAX	1270
   2545  1.52.12.1     jym 
   2546        1.1     cgd #endif	/* _ISPMBOX_H */
   2547