Home | History | Annotate | Line # | Download | only in ic
ispmbox.h revision 1.33.2.2
      1  1.33.2.2  thorpej /* $NetBSD: ispmbox.h,v 1.33.2.2 2002/01/10 19:54:44 thorpej Exp $ */
      2      1.26   mjacob /*
      3      1.26   mjacob  * This driver, which is contained in NetBSD in the files:
      4      1.26   mjacob  *
      5      1.26   mjacob  *	sys/dev/ic/isp.c
      6      1.28      wiz  *	sys/dev/ic/isp_inline.h
      7      1.28      wiz  *	sys/dev/ic/isp_netbsd.c
      8      1.28      wiz  *	sys/dev/ic/isp_netbsd.h
      9      1.28      wiz  *	sys/dev/ic/isp_target.c
     10      1.28      wiz  *	sys/dev/ic/isp_target.h
     11      1.28      wiz  *	sys/dev/ic/isp_tpublic.h
     12      1.28      wiz  *	sys/dev/ic/ispmbox.h
     13      1.28      wiz  *	sys/dev/ic/ispreg.h
     14      1.28      wiz  *	sys/dev/ic/ispvar.h
     15      1.26   mjacob  *	sys/microcode/isp/asm_sbus.h
     16      1.26   mjacob  *	sys/microcode/isp/asm_1040.h
     17      1.26   mjacob  *	sys/microcode/isp/asm_1080.h
     18      1.26   mjacob  *	sys/microcode/isp/asm_12160.h
     19      1.26   mjacob  *	sys/microcode/isp/asm_2100.h
     20      1.26   mjacob  *	sys/microcode/isp/asm_2200.h
     21      1.26   mjacob  *	sys/pci/isp_pci.c
     22      1.26   mjacob  *	sys/sbus/isp_sbus.c
     23      1.26   mjacob  *
     24      1.26   mjacob  * Is being actively maintained by Matthew Jacob (mjacob (at) netbsd.org).
     25      1.26   mjacob  * This driver also is shared source with FreeBSD, OpenBSD, Linux, Solaris,
     26      1.26   mjacob  * Linux versions. This tends to be an interesting maintenance problem.
     27      1.26   mjacob  *
     28      1.26   mjacob  * Please coordinate with Matthew Jacob on changes you wish to make here.
     29      1.26   mjacob  */
     30       1.1      cgd /*
     31      1.18   mjacob  * Copyright (C) 1997, 1998, 1999 National Aeronautics & Space Administration
     32       1.1      cgd  * All rights reserved.
     33       1.1      cgd  *
     34       1.1      cgd  * Redistribution and use in source and binary forms, with or without
     35       1.1      cgd  * modification, are permitted provided that the following conditions
     36       1.1      cgd  * are met:
     37       1.1      cgd  * 1. Redistributions of source code must retain the above copyright
     38      1.18   mjacob  *    notice, this list of conditions and the following disclaimer.
     39       1.1      cgd  * 2. Redistributions in binary form must reproduce the above copyright
     40       1.1      cgd  *    notice, this list of conditions and the following disclaimer in the
     41       1.1      cgd  *    documentation and/or other materials provided with the distribution.
     42       1.1      cgd  * 3. The name of the author may not be used to endorse or promote products
     43      1.18   mjacob  *    derived from this software without specific prior written permission
     44       1.6   mjacob  *
     45      1.18   mjacob  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     46      1.18   mjacob  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     47      1.18   mjacob  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     48      1.18   mjacob  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     49      1.18   mjacob  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     50      1.18   mjacob  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     51      1.18   mjacob  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     52      1.18   mjacob  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     53      1.18   mjacob  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     54      1.18   mjacob  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     55      1.18   mjacob  */
     56      1.18   mjacob 
     57      1.18   mjacob /*
     58      1.18   mjacob  * Mailbox and Queue Entry Definitions for for Qlogic ISP SCSI adapters.
     59      1.18   mjacob  * <mjacob (at) nas.nasa.gov>
     60       1.1      cgd  */
     61       1.1      cgd #ifndef	_ISPMBOX_H
     62       1.1      cgd #define	_ISPMBOX_H
     63       1.1      cgd 
     64       1.1      cgd /*
     65       1.1      cgd  * Mailbox Command Opcodes
     66       1.1      cgd  */
     67       1.1      cgd #define MBOX_NO_OP			0x0000
     68       1.1      cgd #define MBOX_LOAD_RAM			0x0001
     69       1.1      cgd #define MBOX_EXEC_FIRMWARE		0x0002
     70       1.1      cgd #define MBOX_DUMP_RAM			0x0003
     71       1.1      cgd #define MBOX_WRITE_RAM_WORD		0x0004
     72       1.1      cgd #define MBOX_READ_RAM_WORD		0x0005
     73       1.1      cgd #define MBOX_MAILBOX_REG_TEST		0x0006
     74       1.1      cgd #define MBOX_VERIFY_CHECKSUM		0x0007
     75       1.1      cgd #define MBOX_ABOUT_FIRMWARE		0x0008
     76       1.1      cgd 					/*   9 */
     77       1.1      cgd 					/*   a */
     78       1.1      cgd 					/*   b */
     79       1.1      cgd 					/*   c */
     80       1.1      cgd 					/*   d */
     81       1.1      cgd #define MBOX_CHECK_FIRMWARE		0x000e
     82       1.1      cgd 					/*   f */
     83       1.1      cgd #define MBOX_INIT_REQ_QUEUE		0x0010
     84       1.1      cgd #define MBOX_INIT_RES_QUEUE		0x0011
     85       1.1      cgd #define MBOX_EXECUTE_IOCB		0x0012
     86       1.1      cgd #define MBOX_WAKE_UP			0x0013
     87       1.1      cgd #define MBOX_STOP_FIRMWARE		0x0014
     88       1.1      cgd #define MBOX_ABORT			0x0015
     89       1.1      cgd #define MBOX_ABORT_DEVICE		0x0016
     90       1.1      cgd #define MBOX_ABORT_TARGET		0x0017
     91       1.1      cgd #define MBOX_BUS_RESET			0x0018
     92       1.1      cgd #define MBOX_STOP_QUEUE			0x0019
     93       1.1      cgd #define MBOX_START_QUEUE		0x001a
     94       1.1      cgd #define MBOX_SINGLE_STEP_QUEUE		0x001b
     95       1.1      cgd #define MBOX_ABORT_QUEUE		0x001c
     96       1.1      cgd #define MBOX_GET_DEV_QUEUE_STATUS	0x001d
     97       1.1      cgd 					/*  1e */
     98       1.1      cgd #define MBOX_GET_FIRMWARE_STATUS	0x001f
     99       1.1      cgd #define MBOX_GET_INIT_SCSI_ID		0x0020
    100       1.1      cgd #define MBOX_GET_SELECT_TIMEOUT		0x0021
    101       1.1      cgd #define MBOX_GET_RETRY_COUNT		0x0022
    102       1.1      cgd #define MBOX_GET_TAG_AGE_LIMIT		0x0023
    103       1.1      cgd #define MBOX_GET_CLOCK_RATE		0x0024
    104       1.1      cgd #define MBOX_GET_ACT_NEG_STATE		0x0025
    105       1.1      cgd #define MBOX_GET_ASYNC_DATA_SETUP_TIME	0x0026
    106       1.1      cgd #define MBOX_GET_SBUS_PARAMS		0x0027
    107  1.33.2.1  thorpej #define		MBOX_GET_PCI_PARAMS	MBOX_GET_SBUS_PARAMS
    108       1.1      cgd #define MBOX_GET_TARGET_PARAMS		0x0028
    109       1.1      cgd #define MBOX_GET_DEV_QUEUE_PARAMS	0x0029
    110      1.17   mjacob #define	MBOX_GET_RESET_DELAY_PARAMS	0x002a
    111       1.1      cgd 					/*  2b */
    112       1.1      cgd 					/*  2c */
    113       1.1      cgd 					/*  2d */
    114       1.1      cgd 					/*  2e */
    115       1.1      cgd 					/*  2f */
    116       1.1      cgd #define MBOX_SET_INIT_SCSI_ID		0x0030
    117       1.1      cgd #define MBOX_SET_SELECT_TIMEOUT		0x0031
    118       1.1      cgd #define MBOX_SET_RETRY_COUNT		0x0032
    119       1.1      cgd #define MBOX_SET_TAG_AGE_LIMIT		0x0033
    120       1.1      cgd #define MBOX_SET_CLOCK_RATE		0x0034
    121      1.17   mjacob #define MBOX_SET_ACT_NEG_STATE		0x0035
    122       1.1      cgd #define MBOX_SET_ASYNC_DATA_SETUP_TIME	0x0036
    123       1.1      cgd #define MBOX_SET_SBUS_CONTROL_PARAMS	0x0037
    124       1.3   mjacob #define		MBOX_SET_PCI_PARAMETERS	0x0037
    125       1.1      cgd #define MBOX_SET_TARGET_PARAMS		0x0038
    126       1.1      cgd #define MBOX_SET_DEV_QUEUE_PARAMS	0x0039
    127      1.17   mjacob #define	MBOX_SET_RESET_DELAY_PARAMS	0x003a
    128       1.1      cgd 					/*  3b */
    129       1.1      cgd 					/*  3c */
    130       1.1      cgd 					/*  3d */
    131       1.1      cgd 					/*  3e */
    132       1.1      cgd 					/*  3f */
    133       1.1      cgd #define	MBOX_RETURN_BIOS_BLOCK_ADDR	0x0040
    134       1.1      cgd #define	MBOX_WRITE_FOUR_RAM_WORDS	0x0041
    135       1.1      cgd #define	MBOX_EXEC_BIOS_IOCB		0x0042
    136      1.12   mjacob #define	MBOX_SET_FW_FEATURES		0x004a
    137      1.12   mjacob #define	MBOX_GET_FW_FEATURES		0x004b
    138      1.12   mjacob #define		FW_FEATURE_LVD_NOTIFY	0x2
    139      1.12   mjacob #define		FW_FEATURE_FAST_POST	0x1
    140       1.1      cgd 
    141  1.33.2.2  thorpej #define	MBOX_ENABLE_TARGET_MODE		0x0055
    142      1.20   mjacob #define		ENABLE_TARGET_FLAG	0x8000
    143      1.32   mjacob #define		ENABLE_TQING_FLAG	0x0004
    144      1.32   mjacob #define		ENABLE_MANDATORY_DISC	0x0002
    145  1.33.2.2  thorpej #define	MBOX_GET_TARGET_STATUS		0x0056
    146  1.33.2.2  thorpej 
    147  1.33.2.2  thorpej /* These are for the ISP2X00 FC cards */
    148  1.33.2.2  thorpej #define	MBOX_GET_LOOP_ID		0x0020
    149  1.33.2.2  thorpej #define	MBOX_GET_FIRMWARE_OPTIONS	0x0028
    150  1.33.2.2  thorpej #define	MBOX_SET_FIRMWARE_OPTIONS	0x0038
    151  1.33.2.2  thorpej #define	MBOX_GET_RESOURCE_COUNT		0x0042
    152  1.33.2.2  thorpej #define	MBOX_ENHANCED_GET_PDB		0x0047
    153  1.33.2.2  thorpej #define	MBOX_EXEC_COMMAND_IOCB_A64	0x0054
    154  1.33.2.2  thorpej #define	MBOX_INIT_FIRMWARE		0x0060
    155  1.33.2.2  thorpej #define	MBOX_GET_INIT_CONTROL_BLOCK	0x0061
    156  1.33.2.2  thorpej #define	MBOX_INIT_LIP			0x0062
    157  1.33.2.2  thorpej #define	MBOX_GET_FC_AL_POSITION_MAP	0x0063
    158  1.33.2.2  thorpej #define	MBOX_GET_PORT_DB		0x0064
    159  1.33.2.2  thorpej #define	MBOX_CLEAR_ACA			0x0065
    160  1.33.2.2  thorpej #define	MBOX_TARGET_RESET		0x0066
    161  1.33.2.2  thorpej #define	MBOX_CLEAR_TASK_SET		0x0067
    162  1.33.2.2  thorpej #define	MBOX_ABORT_TASK_SET		0x0068
    163  1.33.2.2  thorpej #define	MBOX_GET_FW_STATE		0x0069
    164  1.33.2.2  thorpej #define	MBOX_GET_PORT_NAME		0x006A
    165  1.33.2.2  thorpej #define	MBOX_GET_LINK_STATUS		0x006B
    166  1.33.2.2  thorpej #define	MBOX_INIT_LIP_RESET		0x006C
    167  1.33.2.2  thorpej #define	MBOX_SEND_SNS			0x006E
    168  1.33.2.2  thorpej #define	MBOX_FABRIC_LOGIN		0x006F
    169  1.33.2.2  thorpej #define	MBOX_SEND_CHANGE_REQUEST	0x0070
    170  1.33.2.2  thorpej #define	MBOX_FABRIC_LOGOUT		0x0071
    171  1.33.2.2  thorpej #define	MBOX_INIT_LIP_LOGIN		0x0072
    172  1.33.2.2  thorpej 
    173  1.33.2.2  thorpej #define	MBOX_GET_SET_DATA_RATE		0x005D	/* 23XX only */
    174  1.33.2.2  thorpej #define		MBGSD_GET_RATE	0
    175  1.33.2.2  thorpej #define		MBGSD_SET_RATE	1
    176  1.33.2.2  thorpej #define		MBGSD_ONEGB	0
    177  1.33.2.2  thorpej #define		MBGSD_TWOGB	1
    178  1.33.2.2  thorpej #define		MBGSD_AUTO	2
    179      1.20   mjacob 
    180       1.3   mjacob 
    181       1.3   mjacob #define	ISP2100_SET_PCI_PARAM		0x00ff
    182       1.3   mjacob 
    183       1.1      cgd #define	MBOX_BUSY			0x04
    184       1.1      cgd 
    185       1.1      cgd typedef struct {
    186       1.3   mjacob 	u_int16_t param[8];
    187       1.1      cgd } mbreg_t;
    188       1.1      cgd 
    189       1.1      cgd /*
    190       1.8   mjacob  * Mailbox Command Complete Status Codes
    191       1.8   mjacob  */
    192       1.8   mjacob #define	MBOX_COMMAND_COMPLETE		0x4000
    193       1.8   mjacob #define	MBOX_INVALID_COMMAND		0x4001
    194       1.8   mjacob #define	MBOX_HOST_INTERFACE_ERROR	0x4002
    195       1.8   mjacob #define	MBOX_TEST_FAILED		0x4003
    196       1.8   mjacob #define	MBOX_COMMAND_ERROR		0x4005
    197       1.8   mjacob #define	MBOX_COMMAND_PARAM_ERROR	0x4006
    198      1.22   mjacob #define	MBOX_PORT_ID_USED		0x4007
    199      1.22   mjacob #define	MBOX_LOOP_ID_USED		0x4008
    200      1.22   mjacob #define	MBOX_ALL_IDS_USED		0x4009
    201      1.22   mjacob #define	MBOX_NOT_LOGGED_IN		0x400A
    202      1.25   mjacob #define	MBLOGALL			0x000f
    203      1.25   mjacob #define	MBLOGNONE			0x0000
    204      1.25   mjacob #define	MBLOGMASK(x)			((x) & 0xf)
    205       1.8   mjacob 
    206       1.8   mjacob /*
    207       1.8   mjacob  * Asynchronous event status codes
    208       1.8   mjacob  */
    209       1.8   mjacob #define	ASYNC_BUS_RESET			0x8001
    210       1.8   mjacob #define	ASYNC_SYSTEM_ERROR		0x8002
    211       1.8   mjacob #define	ASYNC_RQS_XFER_ERR		0x8003
    212       1.8   mjacob #define	ASYNC_RSP_XFER_ERR		0x8004
    213       1.8   mjacob #define	ASYNC_QWAKEUP			0x8005
    214       1.8   mjacob #define	ASYNC_TIMEOUT_RESET		0x8006
    215      1.10   mjacob #define	ASYNC_DEVICE_RESET		0x8007
    216       1.8   mjacob #define	ASYNC_EXTMSG_UNDERRUN		0x800A
    217       1.8   mjacob #define	ASYNC_SCAM_INT			0x800B
    218       1.8   mjacob #define	ASYNC_HUNG_SCSI			0x800C
    219       1.8   mjacob #define	ASYNC_KILLED_BUS		0x800D
    220       1.8   mjacob #define	ASYNC_BUS_TRANSIT		0x800E	/* LVD -> HVD, eg. */
    221       1.8   mjacob #define	ASYNC_LIP_OCCURRED		0x8010
    222       1.8   mjacob #define	ASYNC_LOOP_UP			0x8011
    223       1.8   mjacob #define	ASYNC_LOOP_DOWN			0x8012
    224       1.8   mjacob #define	ASYNC_LOOP_RESET		0x8013
    225      1.10   mjacob #define	ASYNC_PDB_CHANGED		0x8014
    226       1.8   mjacob #define	ASYNC_CHANGE_NOTIFY		0x8015
    227  1.33.2.1  thorpej #define	ASYNC_LIP_F8			0x8016
    228      1.33   mjacob #define	ASYNC_CMD_CMPLT			0x8020
    229      1.33   mjacob #define	ASYNC_CTIO_DONE			0x8021
    230      1.33   mjacob #define	ASYNC_IP_XMIT_DONE		0x8022
    231      1.33   mjacob #define	ASYNC_IP_RECV_DONE		0x8023
    232      1.33   mjacob #define	ASYNC_IP_BROADCAST		0x8024
    233      1.33   mjacob #define	ASYNC_IP_RCVQ_LOW		0x8025
    234      1.33   mjacob #define	ASYNC_IP_RCVQ_EMPTY		0x8026
    235      1.33   mjacob #define	ASYNC_IP_RECV_DONE_ALIGNED	0x8027
    236      1.21   mjacob #define	ASYNC_PTPMODE			0x8030
    237      1.33   mjacob #define	ASYNC_RIO1			0x8031
    238      1.33   mjacob #define	ASYNC_RIO2			0x8032
    239      1.33   mjacob #define	ASYNC_RIO3			0x8033
    240      1.33   mjacob #define	ASYNC_RIO4			0x8034
    241      1.33   mjacob #define	ASYNC_RIO5			0x8035
    242      1.21   mjacob #define	ASYNC_CONNMODE			0x8036
    243      1.21   mjacob #define		ISP_CONN_LOOP		1
    244      1.21   mjacob #define		ISP_CONN_PTP		2
    245      1.21   mjacob #define		ISP_CONN_BADLIP		3
    246      1.21   mjacob #define		ISP_CONN_FATAL		4
    247      1.21   mjacob #define		ISP_CONN_LOOPBACK	5
    248      1.33   mjacob #define	ASYNC_RIO_RESP			0x8040
    249      1.33   mjacob #define	ASYNC_RIO_COMP			0x8042
    250      1.33   mjacob /*
    251      1.33   mjacob  * 2.01.31 2200 Only. Need Bit 13 in Mailbox 1 for Set Firmware Options
    252      1.33   mjacob  * mailbox command to enable this.
    253      1.33   mjacob  */
    254      1.33   mjacob #define	ASYNC_QFULL_SENT		0x8049
    255      1.33   mjacob 
    256      1.33   mjacob /*
    257      1.33   mjacob  * Mailbox Usages
    258      1.33   mjacob  */
    259      1.33   mjacob 
    260      1.33   mjacob #define	WRITE_REQUEST_QUEUE_IN_POINTER(isp, value)	\
    261  1.33.2.1  thorpej 	ISP_WRITE(isp, isp->isp_rqstinrp, value)
    262      1.33   mjacob 
    263  1.33.2.1  thorpej #define	READ_REQUEST_QUEUE_OUT_POINTER(isp)		\
    264  1.33.2.1  thorpej 	ISP_READ(isp, isp->isp_rqstoutrp)
    265      1.33   mjacob 
    266  1.33.2.1  thorpej #define	READ_RESPONSE_QUEUE_IN_POINTER(isp)		\
    267  1.33.2.1  thorpej 	ISP_READ(isp, isp->isp_respinrp)
    268      1.33   mjacob 
    269  1.33.2.1  thorpej #define	WRITE_RESPONSE_QUEUE_OUT_POINTER(isp, value)	\
    270  1.33.2.1  thorpej 	ISP_WRITE(isp, isp->isp_respoutrp, value)
    271      1.21   mjacob 
    272       1.8   mjacob /*
    273       1.1      cgd  * Command Structure Definitions
    274       1.1      cgd  */
    275       1.1      cgd 
    276       1.1      cgd typedef struct {
    277       1.1      cgd 	u_int32_t	ds_base;
    278       1.1      cgd 	u_int32_t	ds_count;
    279       1.1      cgd } ispds_t;
    280       1.1      cgd 
    281      1.33   mjacob typedef struct {
    282  1.33.2.1  thorpej 	u_int32_t	ds_base;
    283  1.33.2.1  thorpej 	u_int32_t	ds_basehi;
    284      1.33   mjacob 	u_int32_t	ds_count;
    285      1.33   mjacob } ispds64_t;
    286      1.33   mjacob 
    287  1.33.2.2  thorpej #define	DSTYPE_32BIT	0
    288  1.33.2.2  thorpej #define	DSTYPE_64BIT	1
    289      1.33   mjacob typedef struct {
    290      1.33   mjacob 	u_int16_t	ds_type;	/* 0-> ispds_t, 1-> ispds64_t */
    291      1.33   mjacob 	u_int32_t	ds_segment;	/* unused */
    292      1.33   mjacob 	u_int32_t	ds_base;	/* 32 bit address of DSD list */
    293      1.33   mjacob } ispdslist_t;
    294      1.33   mjacob 
    295      1.33   mjacob 
    296      1.33   mjacob /*
    297      1.33   mjacob  * These elements get swizzled around for SBus instances.
    298      1.33   mjacob  */
    299  1.33.2.2  thorpej #define	ISP_SWAP8(a, b)	{		\
    300      1.16   mjacob 	u_int8_t tmp;			\
    301      1.16   mjacob 	tmp = a;			\
    302      1.16   mjacob 	a = b;				\
    303      1.16   mjacob 	b = tmp;			\
    304      1.16   mjacob }
    305       1.1      cgd typedef struct {
    306       1.1      cgd 	u_int8_t	rqs_entry_type;
    307       1.1      cgd 	u_int8_t	rqs_entry_count;
    308       1.1      cgd 	u_int8_t	rqs_seqno;
    309       1.1      cgd 	u_int8_t	rqs_flags;
    310      1.16   mjacob } isphdr_t;
    311       1.1      cgd 
    312       1.1      cgd /* RQS Flag definitions */
    313       1.1      cgd #define	RQSFLAG_CONTINUATION	0x01
    314       1.1      cgd #define	RQSFLAG_FULL		0x02
    315       1.1      cgd #define	RQSFLAG_BADHEADER	0x04
    316       1.1      cgd #define	RQSFLAG_BADPACKET	0x08
    317       1.3   mjacob 
    318       1.1      cgd /* RQS entry_type definitions */
    319       1.8   mjacob #define	RQSTYPE_REQUEST		0x01
    320       1.8   mjacob #define	RQSTYPE_DATASEG		0x02
    321       1.8   mjacob #define	RQSTYPE_RESPONSE	0x03
    322       1.8   mjacob #define	RQSTYPE_MARKER		0x04
    323       1.8   mjacob #define	RQSTYPE_CMDONLY		0x05
    324       1.8   mjacob #define	RQSTYPE_ATIO		0x06	/* Target Mode */
    325      1.20   mjacob #define	RQSTYPE_CTIO		0x07	/* Target Mode */
    326       1.8   mjacob #define	RQSTYPE_SCAM		0x08
    327       1.8   mjacob #define	RQSTYPE_A64		0x09
    328       1.8   mjacob #define	RQSTYPE_A64_CONT	0x0a
    329       1.8   mjacob #define	RQSTYPE_ENABLE_LUN	0x0b	/* Target Mode */
    330       1.8   mjacob #define	RQSTYPE_MODIFY_LUN	0x0c	/* Target Mode */
    331       1.8   mjacob #define	RQSTYPE_NOTIFY		0x0d	/* Target Mode */
    332       1.8   mjacob #define	RQSTYPE_NOTIFY_ACK	0x0e	/* Target Mode */
    333       1.8   mjacob #define	RQSTYPE_CTIO1		0x0f	/* Target Mode */
    334       1.8   mjacob #define	RQSTYPE_STATUS_CONT	0x10
    335       1.8   mjacob #define	RQSTYPE_T2RQS		0x11
    336      1.33   mjacob #define	RQSTYPE_IP_XMIT		0x13
    337       1.8   mjacob #define	RQSTYPE_T4RQS		0x15
    338      1.33   mjacob #define	RQSTYPE_ATIO2		0x16	/* Target Mode */
    339      1.33   mjacob #define	RQSTYPE_CTIO2		0x17	/* Target Mode */
    340       1.8   mjacob #define	RQSTYPE_CSET0		0x18
    341       1.8   mjacob #define	RQSTYPE_T3RQS		0x19
    342      1.33   mjacob #define	RQSTYPE_IP_XMIT_64	0x1b
    343      1.33   mjacob #define	RQSTYPE_CTIO4		0x1e	/* Target Mode */
    344      1.33   mjacob #define	RQSTYPE_CTIO3		0x1f	/* Target Mode */
    345      1.33   mjacob #define	RQSTYPE_RIO1		0x21
    346      1.33   mjacob #define	RQSTYPE_RIO2		0x22
    347      1.33   mjacob #define	RQSTYPE_IP_RECV		0x23
    348      1.33   mjacob #define	RQSTYPE_IP_RECV_CONT	0x24
    349       1.1      cgd 
    350       1.1      cgd 
    351       1.1      cgd #define	ISP_RQDSEG	4
    352       1.1      cgd typedef struct {
    353       1.1      cgd 	isphdr_t	req_header;
    354       1.1      cgd 	u_int32_t	req_handle;
    355       1.1      cgd 	u_int8_t	req_lun_trn;
    356       1.1      cgd 	u_int8_t	req_target;
    357       1.1      cgd 	u_int16_t	req_cdblen;
    358       1.1      cgd #define	req_modifier	req_cdblen	/* marker packet */
    359       1.1      cgd 	u_int16_t	req_flags;
    360      1.10   mjacob 	u_int16_t	req_reserved;
    361       1.1      cgd 	u_int16_t	req_time;
    362       1.1      cgd 	u_int16_t	req_seg_count;
    363       1.1      cgd 	u_int8_t	req_cdb[12];
    364       1.1      cgd 	ispds_t		req_dataseg[ISP_RQDSEG];
    365       1.1      cgd } ispreq_t;
    366       1.1      cgd 
    367      1.16   mjacob /*
    368      1.16   mjacob  * A request packet can also be a marker packet.
    369      1.16   mjacob  */
    370      1.16   mjacob #define SYNC_DEVICE	0
    371      1.16   mjacob #define SYNC_TARGET	1
    372      1.16   mjacob #define SYNC_ALL	2
    373      1.16   mjacob 
    374  1.33.2.1  thorpej #define	ISP_RQDSEG_T2		3
    375       1.3   mjacob typedef struct {
    376       1.3   mjacob 	isphdr_t	req_header;
    377       1.3   mjacob 	u_int32_t	req_handle;
    378       1.3   mjacob 	u_int8_t	req_lun_trn;
    379       1.3   mjacob 	u_int8_t	req_target;
    380      1.10   mjacob 	u_int16_t	req_scclun;
    381       1.4   mjacob 	u_int16_t	req_flags;
    382       1.4   mjacob 	u_int16_t	_res2;
    383       1.3   mjacob 	u_int16_t	req_time;
    384       1.3   mjacob 	u_int16_t	req_seg_count;
    385  1.33.2.2  thorpej 	u_int8_t	req_cdb[16];
    386       1.3   mjacob 	u_int32_t	req_totalcnt;
    387       1.3   mjacob 	ispds_t		req_dataseg[ISP_RQDSEG_T2];
    388       1.3   mjacob } ispreqt2_t;
    389       1.3   mjacob 
    390  1.33.2.1  thorpej #define	ISP_RQDSEG_T3		2
    391  1.33.2.1  thorpej typedef struct {
    392  1.33.2.1  thorpej 	isphdr_t	req_header;
    393  1.33.2.1  thorpej 	u_int32_t	req_handle;
    394  1.33.2.1  thorpej 	u_int8_t	req_lun_trn;
    395  1.33.2.1  thorpej 	u_int8_t	req_target;
    396  1.33.2.1  thorpej 	u_int16_t	req_scclun;
    397  1.33.2.1  thorpej 	u_int16_t	req_flags;
    398  1.33.2.1  thorpej 	u_int16_t	_res2;
    399  1.33.2.1  thorpej 	u_int16_t	req_time;
    400  1.33.2.1  thorpej 	u_int16_t	req_seg_count;
    401  1.33.2.2  thorpej 	u_int8_t	req_cdb[16];
    402  1.33.2.1  thorpej 	u_int32_t	req_totalcnt;
    403  1.33.2.1  thorpej 	ispds64_t	req_dataseg[ISP_RQDSEG_T3];
    404  1.33.2.1  thorpej } ispreqt3_t;
    405  1.33.2.1  thorpej 
    406       1.1      cgd /* req_flag values */
    407       1.1      cgd #define	REQFLAG_NODISCON	0x0001
    408       1.1      cgd #define	REQFLAG_HTAG		0x0002
    409       1.1      cgd #define	REQFLAG_OTAG		0x0004
    410       1.1      cgd #define	REQFLAG_STAG		0x0008
    411       1.1      cgd #define	REQFLAG_TARGET_RTN	0x0010
    412       1.1      cgd 
    413       1.1      cgd #define	REQFLAG_NODATA		0x0000
    414       1.1      cgd #define	REQFLAG_DATA_IN		0x0020
    415       1.1      cgd #define	REQFLAG_DATA_OUT	0x0040
    416       1.1      cgd #define	REQFLAG_DATA_UNKNOWN	0x0060
    417       1.1      cgd 
    418       1.1      cgd #define	REQFLAG_DISARQ		0x0100
    419       1.8   mjacob #define	REQFLAG_FRC_ASYNC	0x0200
    420       1.8   mjacob #define	REQFLAG_FRC_SYNC	0x0400
    421       1.8   mjacob #define	REQFLAG_FRC_WIDE	0x0800
    422       1.8   mjacob #define	REQFLAG_NOPARITY	0x1000
    423       1.8   mjacob #define	REQFLAG_STOPQ		0x2000
    424       1.8   mjacob #define	REQFLAG_XTRASNS		0x4000
    425       1.8   mjacob #define	REQFLAG_PRIORITY	0x8000
    426       1.1      cgd 
    427       1.1      cgd typedef struct {
    428       1.1      cgd 	isphdr_t	req_header;
    429       1.1      cgd 	u_int32_t	req_handle;
    430       1.1      cgd 	u_int8_t	req_lun_trn;
    431       1.1      cgd 	u_int8_t	req_target;
    432       1.1      cgd 	u_int16_t	req_cdblen;
    433       1.1      cgd 	u_int16_t	req_flags;
    434       1.1      cgd 	u_int16_t	_res1;
    435       1.1      cgd 	u_int16_t	req_time;
    436       1.1      cgd 	u_int16_t	req_seg_count;
    437       1.1      cgd 	u_int8_t	req_cdb[44];
    438       1.1      cgd } ispextreq_t;
    439       1.1      cgd 
    440       1.1      cgd #define	ISP_CDSEG	7
    441       1.1      cgd typedef struct {
    442       1.1      cgd 	isphdr_t	req_header;
    443       1.1      cgd 	u_int32_t	_res1;
    444       1.1      cgd 	ispds_t		req_dataseg[ISP_CDSEG];
    445       1.1      cgd } ispcontreq_t;
    446       1.1      cgd 
    447  1.33.2.1  thorpej #define	ISP_CDSEG64	5
    448  1.33.2.1  thorpej typedef struct {
    449  1.33.2.1  thorpej 	isphdr_t	req_header;
    450  1.33.2.1  thorpej 	ispds64_t	req_dataseg[ISP_CDSEG64];
    451  1.33.2.1  thorpej } ispcontreq64_t;
    452  1.33.2.1  thorpej 
    453       1.1      cgd typedef struct {
    454       1.1      cgd 	isphdr_t	req_header;
    455       1.1      cgd 	u_int32_t	req_handle;
    456       1.1      cgd 	u_int16_t	req_scsi_status;
    457       1.1      cgd 	u_int16_t	req_completion_status;
    458       1.1      cgd 	u_int16_t	req_state_flags;
    459       1.1      cgd 	u_int16_t	req_status_flags;
    460       1.1      cgd 	u_int16_t	req_time;
    461      1.20   mjacob #define	req_response_len	req_time	/* FC only */
    462       1.1      cgd 	u_int16_t	req_sense_len;
    463       1.1      cgd 	u_int32_t	req_resid;
    464      1.27   mjacob 	u_int8_t	req_response[8];	/* FC only */
    465       1.1      cgd 	u_int8_t	req_sense_data[32];
    466       1.1      cgd } ispstatusreq_t;
    467       1.1      cgd 
    468  1.33.2.2  thorpej typedef struct {
    469  1.33.2.2  thorpej 	isphdr_t	req_header;
    470  1.33.2.2  thorpej 	u_int8_t	req_sense_data[60];
    471  1.33.2.2  thorpej } ispstatus_cont_t;
    472  1.33.2.2  thorpej 
    473       1.3   mjacob /*
    474      1.29   mjacob  * For Qlogic 2X00, the high order byte of SCSI status has
    475       1.3   mjacob  * additional meaning.
    476       1.3   mjacob  */
    477       1.3   mjacob #define	RQCS_RU	0x800	/* Residual Under */
    478       1.3   mjacob #define	RQCS_RO	0x400	/* Residual Over */
    479      1.27   mjacob #define	RQCS_RESID	(RQCS_RU|RQCS_RO)
    480       1.3   mjacob #define	RQCS_SV	0x200	/* Sense Length Valid */
    481      1.27   mjacob #define	RQCS_RV	0x100	/* FCP Response Length Valid */
    482       1.3   mjacob 
    483       1.3   mjacob /*
    484       1.3   mjacob  * Completion Status Codes.
    485       1.3   mjacob  */
    486       1.1      cgd #define RQCS_COMPLETE			0x0000
    487       1.1      cgd #define RQCS_DMA_ERROR			0x0002
    488       1.1      cgd #define RQCS_RESET_OCCURRED		0x0004
    489       1.1      cgd #define RQCS_ABORTED			0x0005
    490       1.1      cgd #define RQCS_TIMEOUT			0x0006
    491       1.1      cgd #define RQCS_DATA_OVERRUN		0x0007
    492      1.27   mjacob #define RQCS_DATA_UNDERRUN		0x0015
    493      1.27   mjacob #define	RQCS_QUEUE_FULL			0x001C
    494      1.27   mjacob 
    495      1.27   mjacob /* 1X00 Only Completion Codes */
    496      1.27   mjacob #define RQCS_INCOMPLETE			0x0001
    497      1.27   mjacob #define RQCS_TRANSPORT_ERROR		0x0003
    498       1.1      cgd #define RQCS_COMMAND_OVERRUN		0x0008
    499       1.1      cgd #define RQCS_STATUS_OVERRUN		0x0009
    500       1.1      cgd #define RQCS_BAD_MESSAGE		0x000a
    501       1.1      cgd #define RQCS_NO_MESSAGE_OUT		0x000b
    502       1.1      cgd #define RQCS_EXT_ID_FAILED		0x000c
    503       1.1      cgd #define RQCS_IDE_MSG_FAILED		0x000d
    504       1.1      cgd #define RQCS_ABORT_MSG_FAILED		0x000e
    505       1.1      cgd #define RQCS_REJECT_MSG_FAILED		0x000f
    506       1.1      cgd #define RQCS_NOP_MSG_FAILED		0x0010
    507       1.1      cgd #define RQCS_PARITY_ERROR_MSG_FAILED	0x0011
    508       1.1      cgd #define RQCS_DEVICE_RESET_MSG_FAILED	0x0012
    509       1.1      cgd #define RQCS_ID_MSG_FAILED		0x0013
    510       1.1      cgd #define RQCS_UNEXP_BUS_FREE		0x0014
    511       1.8   mjacob #define	RQCS_XACT_ERR1			0x0018
    512       1.8   mjacob #define	RQCS_XACT_ERR2			0x0019
    513       1.8   mjacob #define	RQCS_XACT_ERR3			0x001A
    514       1.8   mjacob #define	RQCS_BAD_ENTRY			0x001B
    515       1.8   mjacob #define	RQCS_PHASE_SKIPPED		0x001D
    516       1.8   mjacob #define	RQCS_ARQS_FAILED		0x001E
    517       1.8   mjacob #define	RQCS_WIDE_FAILED		0x001F
    518       1.8   mjacob #define	RQCS_SYNCXFER_FAILED		0x0020
    519       1.8   mjacob #define	RQCS_LVD_BUSERR			0x0021
    520       1.8   mjacob 
    521      1.27   mjacob /* 2X00 Only Completion Codes */
    522       1.3   mjacob #define	RQCS_PORT_UNAVAILABLE		0x0028
    523       1.3   mjacob #define	RQCS_PORT_LOGGED_OUT		0x0029
    524       1.3   mjacob #define	RQCS_PORT_CHANGED		0x002A
    525       1.3   mjacob #define	RQCS_PORT_BUSY			0x002B
    526       1.1      cgd 
    527       1.3   mjacob /*
    528      1.27   mjacob  * 1X00 specific State Flags
    529       1.3   mjacob  */
    530       1.1      cgd #define RQSF_GOT_BUS			0x0100
    531       1.1      cgd #define RQSF_GOT_TARGET			0x0200
    532       1.1      cgd #define RQSF_SENT_CDB			0x0400
    533       1.5   mjacob #define RQSF_XFRD_DATA			0x0800
    534       1.1      cgd #define RQSF_GOT_STATUS			0x1000
    535       1.1      cgd #define RQSF_GOT_SENSE			0x2000
    536       1.5   mjacob #define	RQSF_XFER_COMPLETE		0x4000
    537       1.1      cgd 
    538       1.3   mjacob /*
    539      1.29   mjacob  * 2X00 specific State Flags
    540      1.29   mjacob  * (same as 1X00 except RQSF_GOT_BUS/RQSF_GOT_TARGET are not available)
    541      1.29   mjacob  */
    542      1.29   mjacob #define	RQSF_DATA_IN			0x0020
    543      1.29   mjacob #define	RQSF_DATA_OUT			0x0040
    544      1.29   mjacob #define	RQSF_STAG			0x0008
    545      1.29   mjacob #define	RQSF_OTAG			0x0004
    546      1.29   mjacob #define	RQSF_HTAG			0x0002
    547      1.29   mjacob /*
    548      1.27   mjacob  * 1X00 Status Flags
    549       1.3   mjacob  */
    550       1.1      cgd #define RQSTF_DISCONNECT		0x0001
    551       1.1      cgd #define RQSTF_SYNCHRONOUS		0x0002
    552       1.1      cgd #define RQSTF_PARITY_ERROR		0x0004
    553       1.1      cgd #define RQSTF_BUS_RESET			0x0008
    554       1.1      cgd #define RQSTF_DEVICE_RESET		0x0010
    555       1.1      cgd #define RQSTF_ABORTED			0x0020
    556       1.1      cgd #define RQSTF_TIMEOUT			0x0040
    557       1.1      cgd #define RQSTF_NEGOTIATION		0x0080
    558      1.27   mjacob 
    559      1.27   mjacob /*
    560      1.27   mjacob  * 2X00 specific state flags
    561      1.27   mjacob  */
    562      1.27   mjacob /* RQSF_SENT_CDB	*/
    563      1.27   mjacob /* RQSF_XFRD_DATA	*/
    564      1.27   mjacob /* RQSF_GOT_STATUS	*/
    565      1.27   mjacob /* RQSF_XFER_COMPLETE	*/
    566      1.27   mjacob 
    567      1.27   mjacob /*
    568      1.27   mjacob  * 2X00 specific status flags
    569      1.27   mjacob  */
    570      1.27   mjacob /* RQSTF_ABORTED */
    571      1.27   mjacob /* RQSTF_TIMEOUT */
    572      1.27   mjacob #define	RQSTF_DMA_ERROR			0x0080
    573      1.27   mjacob #define	RQSTF_LOGOUT			0x2000
    574      1.27   mjacob 
    575      1.27   mjacob /*
    576      1.27   mjacob  * Miscellaneous
    577      1.27   mjacob  */
    578      1.27   mjacob #ifndef	ISP_EXEC_THROTTLE
    579      1.27   mjacob #define	ISP_EXEC_THROTTLE	16
    580      1.27   mjacob #endif
    581      1.32   mjacob 
    582      1.32   mjacob /*
    583      1.32   mjacob  * About Firmware returns an 'attribute' word in mailbox 6.
    584      1.32   mjacob  */
    585      1.32   mjacob #define	ISP_FW_ATTR_TMODE	0x01
    586      1.32   mjacob #define	ISP_FW_ATTR_SCCLUN	0x02
    587      1.32   mjacob #define	ISP_FW_ATTR_FABRIC	0x04
    588      1.32   mjacob #define	ISP_FW_ATTR_CLASS2	0x08
    589      1.32   mjacob #define	ISP_FW_ATTR_FCTAPE	0x10
    590      1.32   mjacob #define	ISP_FW_ATTR_IP		0x20
    591      1.33   mjacob 
    592      1.33   mjacob /*
    593      1.33   mjacob  * Reduced Interrupt Operation Response Queue Entreis
    594      1.33   mjacob  */
    595      1.33   mjacob 
    596      1.33   mjacob typedef struct {
    597      1.33   mjacob 	isphdr_t	req_header;
    598      1.33   mjacob 	u_int32_t	req_handles[15];
    599      1.33   mjacob } isp_rio1_t;
    600      1.33   mjacob 
    601      1.33   mjacob typedef struct {
    602      1.33   mjacob 	isphdr_t	req_header;
    603      1.33   mjacob 	u_int16_t	req_handles[30];
    604      1.33   mjacob } isp_rio2_t;
    605       1.3   mjacob 
    606       1.3   mjacob /*
    607      1.14   mjacob  * FC (ISP2100) specific data structures
    608       1.3   mjacob  */
    609       1.3   mjacob 
    610       1.3   mjacob /*
    611       1.3   mjacob  * Initialization Control Block
    612       1.8   mjacob  *
    613      1.19   mjacob  * Version One (prime) format.
    614       1.3   mjacob  */
    615      1.19   mjacob typedef struct isp_icb {
    616       1.3   mjacob 	u_int8_t	icb_version;
    617       1.3   mjacob 	u_int8_t	_reserved0;
    618      1.19   mjacob 	u_int16_t	icb_fwoptions;
    619      1.19   mjacob 	u_int16_t	icb_maxfrmlen;
    620       1.3   mjacob 	u_int16_t	icb_maxalloc;
    621       1.3   mjacob 	u_int16_t	icb_execthrottle;
    622       1.3   mjacob 	u_int8_t	icb_retry_count;
    623       1.3   mjacob 	u_int8_t	icb_retry_delay;
    624      1.19   mjacob 	u_int8_t	icb_portname[8];
    625       1.3   mjacob 	u_int16_t	icb_hardaddr;
    626       1.8   mjacob 	u_int8_t	icb_iqdevtype;
    627      1.19   mjacob 	u_int8_t	icb_logintime;
    628      1.19   mjacob 	u_int8_t	icb_nodename[8];
    629       1.3   mjacob 	u_int16_t	icb_rqstout;
    630       1.3   mjacob 	u_int16_t	icb_rspnsin;
    631      1.19   mjacob 	u_int16_t	icb_rqstqlen;
    632      1.19   mjacob 	u_int16_t	icb_rsltqlen;
    633      1.19   mjacob 	u_int16_t	icb_rqstaddr[4];
    634      1.19   mjacob 	u_int16_t	icb_respaddr[4];
    635      1.19   mjacob 	u_int16_t	icb_lunenables;
    636      1.19   mjacob 	u_int8_t	icb_ccnt;
    637      1.19   mjacob 	u_int8_t	icb_icnt;
    638      1.19   mjacob 	u_int16_t	icb_lunetimeout;
    639      1.19   mjacob 	u_int16_t	_reserved1;
    640      1.19   mjacob 	u_int16_t	icb_xfwoptions;
    641      1.19   mjacob 	u_int8_t	icb_racctimer;
    642      1.19   mjacob 	u_int8_t	icb_idelaytimer;
    643      1.19   mjacob 	u_int16_t	icb_zfwoptions;
    644      1.19   mjacob 	u_int16_t	_reserved2[13];
    645       1.3   mjacob } isp_icb_t;
    646       1.8   mjacob #define	ICB_VERSION1	1
    647       1.8   mjacob 
    648      1.18   mjacob #define	ICBOPT_HARD_ADDRESS	0x0001
    649      1.18   mjacob #define	ICBOPT_FAIRNESS		0x0002
    650      1.18   mjacob #define	ICBOPT_FULL_DUPLEX	0x0004
    651      1.18   mjacob #define	ICBOPT_FAST_POST	0x0008
    652      1.18   mjacob #define	ICBOPT_TGT_ENABLE	0x0010
    653      1.18   mjacob #define	ICBOPT_INI_DISABLE	0x0020
    654      1.18   mjacob #define	ICBOPT_INI_ADISC	0x0040
    655      1.18   mjacob #define	ICBOPT_INI_TGTTYPE	0x0080
    656      1.18   mjacob #define	ICBOPT_PDBCHANGE_AE	0x0100
    657      1.18   mjacob #define	ICBOPT_NOLIP		0x0200
    658      1.18   mjacob #define	ICBOPT_SRCHDOWN		0x0400
    659      1.18   mjacob #define	ICBOPT_PREVLOOP		0x0800
    660      1.18   mjacob #define	ICBOPT_STOP_ON_QFULL	0x1000
    661      1.18   mjacob #define	ICBOPT_FULL_LOGIN	0x2000
    662      1.31   mjacob #define	ICBOPT_BOTH_WWNS	0x4000
    663      1.19   mjacob #define	ICBOPT_EXTENDED		0x8000
    664      1.21   mjacob 
    665      1.21   mjacob #define	ICBXOPT_CLASS2_ACK0	0x0200
    666      1.21   mjacob #define	ICBXOPT_CLASS2		0x0100
    667      1.21   mjacob #define	ICBXOPT_LOOP_ONLY	(0 << 4)
    668      1.21   mjacob #define	ICBXOPT_PTP_ONLY	(1 << 4)
    669      1.21   mjacob #define	ICBXOPT_LOOP_2_PTP	(2 << 4)
    670      1.21   mjacob #define	ICBXOPT_PTP_2_LOOP	(3 << 4)
    671      1.21   mjacob 
    672      1.21   mjacob #define	ICBXOPT_RIO_OFF		0
    673      1.21   mjacob #define	ICBXOPT_RIO_16BIT	1
    674      1.21   mjacob #define	ICBXOPT_RIO_32BIT	2
    675  1.33.2.2  thorpej #define	ICBXOPT_RIO_16BIT_IOCB	3
    676  1.33.2.2  thorpej #define	ICBXOPT_RIO_32BIT_IOCB	4
    677      1.21   mjacob 
    678  1.33.2.2  thorpej #define	ICBZOPT_ENA_RDXFR_RDY	0x01
    679  1.33.2.2  thorpej #define	ICBZOPT_ENA_OOF		(1 << 6) /* out of order frame handling */
    680  1.33.2.1  thorpej /* These 3 only apply to the 2300 */
    681  1.33.2.2  thorpej #define	ICBZOPT_RATE_ONEGB	(MBGSD_ONEGB << 14)
    682  1.33.2.2  thorpej #define	ICBZOPT_RATE_TWOGB	(MBGSD_TWOGB << 14)
    683  1.33.2.2  thorpej #define	ICBZOPT_RATE_AUTO	(MBGSD_AUTO << 14)
    684       1.8   mjacob 
    685       1.8   mjacob 
    686       1.8   mjacob #define	ICB_MIN_FRMLEN		256
    687       1.8   mjacob #define	ICB_MAX_FRMLEN		2112
    688       1.8   mjacob #define	ICB_DFLT_FRMLEN		1024
    689      1.18   mjacob #define	ICB_DFLT_ALLOC		256
    690      1.18   mjacob #define	ICB_DFLT_THROTTLE	16
    691      1.18   mjacob #define	ICB_DFLT_RDELAY		5
    692      1.18   mjacob #define	ICB_DFLT_RCOUNT		3
    693      1.18   mjacob 
    694       1.8   mjacob 
    695       1.8   mjacob #define	RQRSP_ADDR0015	0
    696       1.8   mjacob #define	RQRSP_ADDR1631	1
    697       1.8   mjacob #define	RQRSP_ADDR3247	2
    698       1.8   mjacob #define	RQRSP_ADDR4863	3
    699       1.8   mjacob 
    700       1.8   mjacob 
    701       1.8   mjacob #define	ICB_NNM0	7
    702       1.8   mjacob #define	ICB_NNM1	6
    703       1.8   mjacob #define	ICB_NNM2	5
    704       1.8   mjacob #define	ICB_NNM3	4
    705       1.8   mjacob #define	ICB_NNM4	3
    706       1.8   mjacob #define	ICB_NNM5	2
    707       1.8   mjacob #define	ICB_NNM6	1
    708       1.8   mjacob #define	ICB_NNM7	0
    709       1.3   mjacob 
    710       1.8   mjacob #define	MAKE_NODE_NAME_FROM_WWN(array, wwn)	\
    711       1.8   mjacob 	array[ICB_NNM0] = (u_int8_t) ((wwn >>  0) & 0xff), \
    712       1.8   mjacob 	array[ICB_NNM1] = (u_int8_t) ((wwn >>  8) & 0xff), \
    713       1.8   mjacob 	array[ICB_NNM2] = (u_int8_t) ((wwn >> 16) & 0xff), \
    714       1.8   mjacob 	array[ICB_NNM3] = (u_int8_t) ((wwn >> 24) & 0xff), \
    715       1.8   mjacob 	array[ICB_NNM4] = (u_int8_t) ((wwn >> 32) & 0xff), \
    716       1.8   mjacob 	array[ICB_NNM5] = (u_int8_t) ((wwn >> 40) & 0xff), \
    717       1.8   mjacob 	array[ICB_NNM6] = (u_int8_t) ((wwn >> 48) & 0xff), \
    718       1.8   mjacob 	array[ICB_NNM7] = (u_int8_t) ((wwn >> 56) & 0xff)
    719      1.30   mjacob 
    720      1.30   mjacob /*
    721      1.30   mjacob  * FC-AL Position Map
    722      1.30   mjacob  *
    723      1.30   mjacob  * This is an at most 128 byte map that returns either
    724      1.30   mjacob  * the LILP or Firmware generated list of ports.
    725      1.30   mjacob  *
    726      1.30   mjacob  * We deviate a bit from the returned qlogic format to
    727      1.30   mjacob  * use an extra bit to say whether this was a LILP or
    728      1.30   mjacob  * f/w generated map.
    729      1.30   mjacob  */
    730      1.30   mjacob typedef struct {
    731      1.30   mjacob 	u_int8_t	fwmap	: 1,
    732      1.30   mjacob 			count	: 7;
    733      1.30   mjacob 	u_int8_t	map[127];
    734      1.30   mjacob } fcpos_map_t;
    735      1.14   mjacob 
    736      1.14   mjacob /*
    737      1.14   mjacob  * Port Data Base Element
    738      1.14   mjacob  */
    739      1.14   mjacob 
    740      1.14   mjacob typedef struct {
    741      1.14   mjacob 	u_int16_t	pdb_options;
    742      1.14   mjacob 	u_int8_t	pdb_mstate;
    743      1.14   mjacob 	u_int8_t	pdb_sstate;
    744      1.23       he #define	BITS2WORD(x)	((x)[0] << 16 | (x)[3] << 8 | (x)[2])
    745      1.14   mjacob 	u_int8_t	pdb_hardaddr_bits[4];
    746      1.14   mjacob 	u_int8_t	pdb_portid_bits[4];
    747      1.14   mjacob 	u_int8_t	pdb_nodename[8];
    748      1.14   mjacob 	u_int8_t	pdb_portname[8];
    749      1.14   mjacob 	u_int16_t	pdb_execthrottle;
    750      1.14   mjacob 	u_int16_t	pdb_exec_count;
    751      1.14   mjacob 	u_int8_t	pdb_retry_count;
    752      1.14   mjacob 	u_int8_t	pdb_retry_delay;
    753      1.14   mjacob 	u_int16_t	pdb_resalloc;
    754      1.14   mjacob 	u_int16_t	pdb_curalloc;
    755      1.14   mjacob 	u_int16_t	pdb_qhead;
    756      1.14   mjacob 	u_int16_t	pdb_qtail;
    757      1.14   mjacob 	u_int16_t	pdb_tl_next;
    758      1.14   mjacob 	u_int16_t	pdb_tl_last;
    759      1.14   mjacob 	u_int16_t	pdb_features;	/* PLOGI, Common Service */
    760      1.14   mjacob 	u_int16_t	pdb_pconcurrnt;	/* PLOGI, Common Service */
    761      1.14   mjacob 	u_int16_t	pdb_roi;	/* PLOGI, Common Service */
    762      1.14   mjacob 	u_int8_t	pdb_target;
    763      1.14   mjacob 	u_int8_t	pdb_initiator;	/* PLOGI, Class 3 Control Flags */
    764      1.14   mjacob 	u_int16_t	pdb_rdsiz;	/* PLOGI, Class 3 */
    765      1.14   mjacob 	u_int16_t	pdb_ncseq;	/* PLOGI, Class 3 */
    766      1.14   mjacob 	u_int16_t	pdb_noseq;	/* PLOGI, Class 3 */
    767      1.14   mjacob 	u_int16_t	pdb_labrtflg;
    768      1.14   mjacob 	u_int16_t	pdb_lstopflg;
    769      1.14   mjacob 	u_int16_t	pdb_sqhead;
    770      1.14   mjacob 	u_int16_t	pdb_sqtail;
    771      1.14   mjacob 	u_int16_t	pdb_ptimer;
    772      1.14   mjacob 	u_int16_t	pdb_nxt_seqid;
    773      1.14   mjacob 	u_int16_t	pdb_fcount;
    774      1.14   mjacob 	u_int16_t	pdb_prli_len;
    775      1.14   mjacob 	u_int16_t	pdb_prli_svc0;
    776      1.14   mjacob 	u_int16_t	pdb_prli_svc3;
    777      1.14   mjacob 	u_int16_t	pdb_loopid;
    778      1.14   mjacob 	u_int16_t	pdb_il_ptr;
    779      1.14   mjacob 	u_int16_t	pdb_sl_ptr;
    780      1.14   mjacob } isp_pdb_t;
    781      1.14   mjacob 
    782      1.14   mjacob #define	PDB_OPTIONS_XMITTING	(1<<11)
    783      1.14   mjacob #define	PDB_OPTIONS_LNKXMIT	(1<<10)
    784      1.14   mjacob #define	PDB_OPTIONS_ABORTED	(1<<9)
    785      1.14   mjacob #define	PDB_OPTIONS_ADISC	(1<<1)
    786      1.14   mjacob 
    787      1.14   mjacob #define	PDB_STATE_DISCOVERY	0
    788      1.14   mjacob #define	PDB_STATE_WDISC_ACK	1
    789      1.14   mjacob #define	PDB_STATE_PLOGI		2
    790      1.14   mjacob #define	PDB_STATE_PLOGI_ACK	3
    791      1.14   mjacob #define	PDB_STATE_PRLI		4
    792      1.14   mjacob #define	PDB_STATE_PRLI_ACK	5
    793      1.14   mjacob #define	PDB_STATE_LOGGED_IN	6
    794      1.14   mjacob #define	PDB_STATE_PORT_UNAVAIL	7
    795      1.14   mjacob #define	PDB_STATE_PRLO		8
    796      1.14   mjacob #define	PDB_STATE_PRLO_ACK	9
    797      1.14   mjacob #define	PDB_STATE_PLOGO		10
    798      1.14   mjacob #define	PDB_STATE_PLOG_ACK	11
    799      1.14   mjacob 
    800      1.14   mjacob #define		SVC3_TGT_ROLE		0x10
    801      1.14   mjacob #define 	SVC3_INI_ROLE		0x20
    802      1.14   mjacob #define			SVC3_ROLE_MASK	0x30
    803      1.18   mjacob #define			SVC3_ROLE_SHIFT	4
    804      1.18   mjacob 
    805      1.18   mjacob #define	SNS_GAN	0x100
    806      1.18   mjacob #define	SNS_GP3	0x171
    807      1.29   mjacob #define	SNS_RFT	0x217
    808      1.18   mjacob typedef struct {
    809      1.18   mjacob 	u_int16_t	snscb_rblen;	/* response buffer length (words) */
    810      1.18   mjacob 	u_int16_t	snscb_res0;
    811      1.18   mjacob 	u_int16_t	snscb_addr[4];	/* response buffer address */
    812      1.18   mjacob 	u_int16_t	snscb_sblen;	/* subcommand buffer length (words) */
    813      1.18   mjacob 	u_int16_t	snscb_res1;
    814      1.18   mjacob 	u_int16_t	snscb_data[1];	/* variable data */
    815      1.18   mjacob } sns_screq_t;	/* Subcommand Request Structure */
    816      1.18   mjacob #define	SNS_GAN_REQ_SIZE	(sizeof (sns_screq_t)+(5*(sizeof (u_int16_t))))
    817      1.18   mjacob #define	SNS_GP3_REQ_SIZE	(sizeof (sns_screq_t)+(5*(sizeof (u_int16_t))))
    818      1.29   mjacob #define	SNS_RFT_REQ_SIZE	(sizeof (sns_screq_t)+(21*(sizeof (u_int16_t))))
    819      1.18   mjacob 
    820      1.18   mjacob typedef struct {
    821      1.18   mjacob 	u_int8_t	snscb_cthdr[16];
    822      1.18   mjacob 	u_int8_t	snscb_port_type;
    823      1.18   mjacob 	u_int8_t	snscb_port_id[3];
    824      1.18   mjacob 	u_int8_t	snscb_portname[8];
    825      1.18   mjacob 	u_int16_t	snscb_data[1];	/* variable data */
    826      1.18   mjacob } sns_scrsp_t;	/* Subcommand Response Structure */
    827      1.18   mjacob #define	SNS_GAN_RESP_SIZE	608	/* Maximum response size (bytes) */
    828      1.18   mjacob #define	SNS_GP3_RESP_SIZE	532	/* XXX: For 128 ports */
    829      1.29   mjacob #define	SNS_RFT_RESP_SIZE	16
    830      1.22   mjacob 
    831      1.22   mjacob typedef struct {
    832      1.22   mjacob 	u_int8_t	snscb_cthdr[16];
    833      1.22   mjacob 	u_int8_t	snscb_port_type;
    834      1.22   mjacob 	u_int8_t	snscb_port_id[3];
    835      1.22   mjacob 	u_int8_t	snscb_portname[8];
    836      1.22   mjacob 	u_int8_t	snscb_pnlen;		/* symbolic port name length */
    837      1.22   mjacob 	u_int8_t	snscb_pname[255];	/* symbolic port name */
    838      1.22   mjacob 	u_int8_t	snscb_nodename[8];
    839      1.22   mjacob 	u_int8_t	snscb_nnlen;		/* symbolic node name length */
    840      1.22   mjacob 	u_int8_t	snscb_nname[255];	/* symbolic node name */
    841      1.22   mjacob 	u_int8_t	snscb_ipassoc[8];
    842      1.22   mjacob 	u_int8_t	snscb_ipaddr[16];
    843      1.22   mjacob 	u_int8_t	snscb_svc_class[4];
    844      1.22   mjacob 	u_int8_t	snscb_fc4_types[32];
    845      1.22   mjacob 	u_int8_t	snscb_fpname[8];
    846      1.22   mjacob 	u_int8_t	snscb_reserved;
    847      1.22   mjacob 	u_int8_t	snscb_hardaddr[3];
    848      1.22   mjacob } sns_ganrsp_t;	/* Subcommand Response Structure */
    849       1.1      cgd 
    850       1.1      cgd #endif	/* _ISPMBOX_H */
    851