2002-05-17 22:49:42 +04:00
|
|
|
/* $NetBSD: isp_target.h,v 1.18 2002/05/17 18:49:43 mjacob Exp $ */
|
2000-08-14 11:11:14 +04:00
|
|
|
/*
|
|
|
|
* This driver, which is contained in NetBSD in the files:
|
|
|
|
*
|
|
|
|
* sys/dev/ic/isp.c
|
2000-12-23 04:37:57 +03:00
|
|
|
* sys/dev/ic/isp_inline.h
|
|
|
|
* sys/dev/ic/isp_netbsd.c
|
|
|
|
* sys/dev/ic/isp_netbsd.h
|
|
|
|
* sys/dev/ic/isp_target.c
|
|
|
|
* sys/dev/ic/isp_target.h
|
|
|
|
* sys/dev/ic/isp_tpublic.h
|
|
|
|
* sys/dev/ic/ispmbox.h
|
|
|
|
* sys/dev/ic/ispreg.h
|
|
|
|
* sys/dev/ic/ispvar.h
|
2000-08-14 11:11:14 +04:00
|
|
|
* sys/microcode/isp/asm_sbus.h
|
|
|
|
* sys/microcode/isp/asm_1040.h
|
|
|
|
* sys/microcode/isp/asm_1080.h
|
|
|
|
* sys/microcode/isp/asm_12160.h
|
|
|
|
* sys/microcode/isp/asm_2100.h
|
|
|
|
* sys/microcode/isp/asm_2200.h
|
|
|
|
* sys/pci/isp_pci.c
|
|
|
|
* sys/sbus/isp_sbus.c
|
|
|
|
*
|
|
|
|
* Is being actively maintained by Matthew Jacob (mjacob@netbsd.org).
|
|
|
|
* This driver also is shared source with FreeBSD, OpenBSD, Linux, Solaris,
|
|
|
|
* Linux versions. This tends to be an interesting maintenance problem.
|
|
|
|
*
|
|
|
|
* Please coordinate with Matthew Jacob on changes you wish to make here.
|
|
|
|
*/
|
2000-01-05 22:50:05 +03:00
|
|
|
/*
|
|
|
|
* Qlogic Target Mode Structure and Flag Definitions
|
|
|
|
*
|
|
|
|
* Copyright (c) 1997, 1998
|
|
|
|
* Patrick Stirling
|
|
|
|
* pms@psconsult.com
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
2001-03-14 08:46:50 +03:00
|
|
|
* Additional Copyright (c) 1999, 2000, 2001
|
2000-01-05 22:50:05 +03:00
|
|
|
* Matthew Jacob
|
|
|
|
* mjacob@feral.com
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice immediately at the beginning of the file, without modification,
|
|
|
|
* this list of conditions, and the following disclaimer.
|
2001-03-14 08:46:50 +03:00
|
|
|
* 2. The name of the author may not be used to endorse or promote products
|
2000-01-05 22:50:05 +03:00
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
|
|
|
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
*/
|
2001-03-14 08:46:50 +03:00
|
|
|
#ifndef _ISP_TARGET_H
|
|
|
|
#define _ISP_TARGET_H
|
2000-01-05 22:50:05 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Defines for all entry types
|
|
|
|
*/
|
|
|
|
#define QLTM_SVALID 0x80
|
|
|
|
#define QLTM_SENSELEN 18
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Structure for Enable Lun and Modify Lun queue entries
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
isphdr_t le_header;
|
|
|
|
u_int32_t le_reserved;
|
|
|
|
u_int8_t le_lun;
|
|
|
|
u_int8_t le_rsvd;
|
|
|
|
u_int8_t le_ops; /* Modify LUN only */
|
|
|
|
u_int8_t le_tgt; /* Not for FC */
|
|
|
|
u_int32_t le_flags; /* Not for FC */
|
|
|
|
u_int8_t le_status;
|
|
|
|
u_int8_t le_reserved2;
|
|
|
|
u_int8_t le_cmd_count;
|
|
|
|
u_int8_t le_in_count;
|
|
|
|
u_int8_t le_cdb6len; /* Not for FC */
|
|
|
|
u_int8_t le_cdb7len; /* Not for FC */
|
|
|
|
u_int16_t le_timeout;
|
|
|
|
u_int16_t le_reserved3[20];
|
|
|
|
} lun_entry_t;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* le_flags values
|
|
|
|
*/
|
2001-04-05 06:28:17 +04:00
|
|
|
#define LUN_TQAE 0x00000002 /* bit1 Tagged Queue Action Enable */
|
2000-01-05 22:50:05 +03:00
|
|
|
#define LUN_DSSM 0x01000000 /* bit24 Disable Sending SDP Message */
|
2000-07-06 02:25:34 +04:00
|
|
|
#define LUN_DISAD 0x02000000 /* bit25 Disable autodisconnect */
|
2000-01-05 22:50:05 +03:00
|
|
|
#define LUN_DM 0x40000000 /* bit30 Disconnects Mandatory */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* le_ops values
|
|
|
|
*/
|
|
|
|
#define LUN_CCINCR 0x01 /* increment command count */
|
|
|
|
#define LUN_CCDECR 0x02 /* decrement command count */
|
|
|
|
#define LUN_ININCR 0x40 /* increment immed. notify count */
|
|
|
|
#define LUN_INDECR 0x80 /* decrement immed. notify count */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* le_status values
|
|
|
|
*/
|
|
|
|
#define LUN_OK 0x01 /* we be rockin' */
|
|
|
|
#define LUN_ERR 0x04 /* request completed with error */
|
|
|
|
#define LUN_INVAL 0x06 /* invalid request */
|
|
|
|
#define LUN_NOCAP 0x16 /* can't provide requested capability */
|
|
|
|
#define LUN_ENABLED 0x3E /* LUN already enabled */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Immediate Notify Entry structure
|
|
|
|
*/
|
|
|
|
#define IN_MSGLEN 8 /* 8 bytes */
|
|
|
|
#define IN_RSVDLEN 8 /* 8 words */
|
|
|
|
typedef struct {
|
|
|
|
isphdr_t in_header;
|
|
|
|
u_int32_t in_reserved;
|
|
|
|
u_int8_t in_lun; /* lun */
|
|
|
|
u_int8_t in_iid; /* initiator */
|
|
|
|
u_int8_t in_reserved2;
|
|
|
|
u_int8_t in_tgt; /* target */
|
|
|
|
u_int32_t in_flags;
|
|
|
|
u_int8_t in_status;
|
|
|
|
u_int8_t in_rsvd2;
|
|
|
|
u_int8_t in_tag_val; /* tag value */
|
|
|
|
u_int8_t in_tag_type; /* tag type */
|
|
|
|
u_int16_t in_seqid; /* sequence id */
|
|
|
|
u_int8_t in_msg[IN_MSGLEN]; /* SCSI message bytes */
|
|
|
|
u_int16_t in_reserved3[IN_RSVDLEN];
|
|
|
|
u_int8_t in_sense[QLTM_SENSELEN];/* suggested sense data */
|
|
|
|
} in_entry_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
isphdr_t in_header;
|
|
|
|
u_int32_t in_reserved;
|
|
|
|
u_int8_t in_lun; /* lun */
|
|
|
|
u_int8_t in_iid; /* initiator */
|
|
|
|
u_int16_t in_scclun;
|
|
|
|
u_int32_t in_reserved2;
|
|
|
|
u_int16_t in_status;
|
|
|
|
u_int16_t in_task_flags;
|
|
|
|
u_int16_t in_seqid; /* sequence id */
|
|
|
|
} in_fcentry_t;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Values for the in_status field
|
|
|
|
*/
|
2000-07-20 02:19:23 +04:00
|
|
|
#define IN_REJECT 0x0D /* Message Reject message received */
|
2000-01-05 22:50:05 +03:00
|
|
|
#define IN_RESET 0x0E /* Bus Reset occurred */
|
|
|
|
#define IN_NO_RCAP 0x16 /* requested capability not available */
|
|
|
|
#define IN_IDE_RECEIVED 0x33 /* Initiator Detected Error msg received */
|
|
|
|
#define IN_RSRC_UNAVAIL 0x34 /* resource unavailable */
|
|
|
|
#define IN_MSG_RECEIVED 0x36 /* SCSI message received */
|
|
|
|
#define IN_ABORT_TASK 0x20 /* task named in RX_ID is being aborted (FC) */
|
|
|
|
#define IN_PORT_LOGOUT 0x29 /* port has logged out (FC) */
|
|
|
|
#define IN_PORT_CHANGED 0x2A /* port changed */
|
|
|
|
#define IN_GLOBAL_LOGO 0x2E /* all ports logged out */
|
2000-07-20 02:19:23 +04:00
|
|
|
#define IN_NO_NEXUS 0x3B /* Nexus not established */
|
2000-01-05 22:50:05 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Values for the in_task_flags field- should only get one at a time!
|
|
|
|
*/
|
|
|
|
#define TASK_FLAGS_ABORT_TASK (1<<9)
|
|
|
|
#define TASK_FLAGS_CLEAR_TASK_SET (1<<10)
|
|
|
|
#define TASK_FLAGS_TARGET_RESET (1<<13)
|
|
|
|
#define TASK_FLAGS_CLEAR_ACA (1<<14)
|
|
|
|
#define TASK_FLAGS_TERMINATE_TASK (1<<15)
|
|
|
|
|
|
|
|
#ifndef MSG_ABORT_TAG
|
|
|
|
#define MSG_ABORT_TAG 0x06
|
|
|
|
#endif
|
|
|
|
#ifndef MSG_CLEAR_QUEUE
|
|
|
|
#define MSG_CLEAR_QUEUE 0x0e
|
|
|
|
#endif
|
|
|
|
#ifndef MSG_BUS_DEV_RESET
|
|
|
|
#define MSG_BUS_DEV_RESET 0x0b
|
|
|
|
#endif
|
|
|
|
#ifndef MSG_REL_RECOVERY
|
|
|
|
#define MSG_REL_RECOVERY 0x10
|
|
|
|
#endif
|
|
|
|
#ifndef MSG_TERM_IO_PROC
|
|
|
|
#define MSG_TERM_IO_PROC 0x11
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Notify Acknowledge Entry structure
|
|
|
|
*/
|
|
|
|
#define NA_RSVDLEN 22
|
|
|
|
typedef struct {
|
|
|
|
isphdr_t na_header;
|
|
|
|
u_int32_t na_reserved;
|
|
|
|
u_int8_t na_lun; /* lun */
|
|
|
|
u_int8_t na_iid; /* initiator */
|
|
|
|
u_int8_t na_reserved2;
|
|
|
|
u_int8_t na_tgt; /* target */
|
|
|
|
u_int32_t na_flags;
|
|
|
|
u_int8_t na_status;
|
|
|
|
u_int8_t na_event;
|
|
|
|
u_int16_t na_seqid; /* sequence id */
|
|
|
|
u_int16_t na_reserved3[NA_RSVDLEN];
|
|
|
|
} na_entry_t;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Value for the na_event field
|
|
|
|
*/
|
|
|
|
#define NA_RST_CLRD 0x80 /* Clear an async event notification */
|
2000-05-13 20:53:03 +04:00
|
|
|
#define NA_OK 0x01 /* Notify Acknowledge Succeeded */
|
|
|
|
#define NA_INVALID 0x06 /* Invalid Notify Acknowledge */
|
2000-01-05 22:50:05 +03:00
|
|
|
|
|
|
|
#define NA2_RSVDLEN 21
|
|
|
|
typedef struct {
|
|
|
|
isphdr_t na_header;
|
|
|
|
u_int32_t na_reserved;
|
|
|
|
u_int8_t na_lun; /* lun */
|
|
|
|
u_int8_t na_iid; /* initiator */
|
|
|
|
u_int16_t na_scclun;
|
|
|
|
u_int16_t na_flags;
|
|
|
|
u_int16_t na_reserved2;
|
|
|
|
u_int16_t na_status;
|
|
|
|
u_int16_t na_task_flags;
|
|
|
|
u_int16_t na_seqid; /* sequence id */
|
|
|
|
u_int16_t na_reserved3[NA2_RSVDLEN];
|
|
|
|
} na_fcentry_t;
|
|
|
|
#define NAFC_RCOUNT 0x80 /* increment resource count */
|
|
|
|
#define NAFC_RST_CLRD 0x20 /* Clear LIP Reset */
|
|
|
|
/*
|
|
|
|
* Accept Target I/O Entry structure
|
|
|
|
*/
|
|
|
|
#define ATIO_CDBLEN 26
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
isphdr_t at_header;
|
2001-03-14 08:46:50 +03:00
|
|
|
u_int16_t at_reserved;
|
|
|
|
u_int16_t at_handle;
|
2000-01-05 22:50:05 +03:00
|
|
|
u_int8_t at_lun; /* lun */
|
|
|
|
u_int8_t at_iid; /* initiator */
|
|
|
|
u_int8_t at_cdblen; /* cdb length */
|
|
|
|
u_int8_t at_tgt; /* target */
|
|
|
|
u_int32_t at_flags;
|
|
|
|
u_int8_t at_status; /* firmware status */
|
|
|
|
u_int8_t at_scsi_status; /* scsi status */
|
|
|
|
u_int8_t at_tag_val; /* tag value */
|
|
|
|
u_int8_t at_tag_type; /* tag type */
|
|
|
|
u_int8_t at_cdb[ATIO_CDBLEN]; /* received CDB */
|
|
|
|
u_int8_t at_sense[QLTM_SENSELEN];/* suggested sense data */
|
|
|
|
} at_entry_t;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* at_flags values
|
|
|
|
*/
|
|
|
|
#define AT_NODISC 0x00008000 /* disconnect disabled */
|
2001-04-05 06:28:17 +04:00
|
|
|
#define AT_TQAE 0x00000002 /* Tagged Queue Action enabled */
|
2000-01-05 22:50:05 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* at_status values
|
|
|
|
*/
|
|
|
|
#define AT_PATH_INVALID 0x07 /* ATIO sent to firmware for disabled lun */
|
|
|
|
#define AT_RESET 0x0E /* SCSI Bus Reset Occurred */
|
|
|
|
#define AT_PHASE_ERROR 0x14 /* Bus phase sequence error */
|
|
|
|
#define AT_NOCAP 0x16 /* Requested capability not available */
|
|
|
|
#define AT_BDR_MSG 0x17 /* Bus Device Reset msg received */
|
|
|
|
#define AT_CDB 0x3D /* CDB received */
|
|
|
|
|
2001-04-05 06:28:17 +04:00
|
|
|
/*
|
|
|
|
* Macros to create and fetch and test concatenated handle and tag value macros
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define AT_MAKE_TAGID(tid, aep) \
|
|
|
|
tid = ((aep)->at_handle << 16); \
|
|
|
|
if ((aep)->at_flags & AT_TQAE) \
|
|
|
|
(tid) |= ((aep)->at_tag_val + 1)
|
|
|
|
|
|
|
|
#define CT_MAKE_TAGID(tid, ct) \
|
|
|
|
tid = ((ct)->ct_fwhandle << 16); \
|
|
|
|
if ((ct)->ct_flags & CT_TQAE) \
|
|
|
|
(tid) |= ((ct)->ct_tag_val + 1)
|
|
|
|
|
|
|
|
#define AT_HAS_TAG(val) ((val) & 0xffff)
|
|
|
|
#define AT_GET_TAG(val) AT_HAS_TAG(val) - 1
|
|
|
|
#define AT_GET_HANDLE(val) ((val) >> 16)
|
|
|
|
|
2000-01-05 22:50:05 +03:00
|
|
|
/*
|
|
|
|
* Accept Target I/O Entry structure, Type 2
|
|
|
|
*/
|
|
|
|
#define ATIO2_CDBLEN 16
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
isphdr_t at_header;
|
|
|
|
u_int32_t at_reserved;
|
|
|
|
u_int8_t at_lun; /* lun or reserved */
|
|
|
|
u_int8_t at_iid; /* initiator */
|
|
|
|
u_int16_t at_rxid; /* response ID */
|
|
|
|
u_int16_t at_flags;
|
|
|
|
u_int16_t at_status; /* firmware status */
|
|
|
|
u_int8_t at_reserved1;
|
|
|
|
u_int8_t at_taskcodes;
|
|
|
|
u_int8_t at_taskflags;
|
|
|
|
u_int8_t at_execodes;
|
|
|
|
u_int8_t at_cdb[ATIO2_CDBLEN]; /* received CDB */
|
|
|
|
u_int32_t at_datalen; /* allocated data len */
|
2002-02-22 01:32:40 +03:00
|
|
|
u_int16_t at_scclun; /* SCC Lun or reserved */
|
|
|
|
u_int16_t at_wwpn[4]; /* WWPN of initiator */
|
|
|
|
u_int16_t at_reserved2[6];
|
2001-03-14 08:46:50 +03:00
|
|
|
u_int16_t at_oxid;
|
2000-01-05 22:50:05 +03:00
|
|
|
} at2_entry_t;
|
|
|
|
|
2000-12-28 11:23:48 +03:00
|
|
|
#define ATIO2_WWPN_OFFSET 0x2A
|
|
|
|
#define ATIO2_OXID_OFFSET 0x3E
|
|
|
|
|
2000-01-05 22:50:05 +03:00
|
|
|
#define ATIO2_TC_ATTR_MASK 0x7
|
|
|
|
#define ATIO2_TC_ATTR_SIMPLEQ 0
|
|
|
|
#define ATIO2_TC_ATTR_HEADOFQ 1
|
|
|
|
#define ATIO2_TC_ATTR_ORDERED 2
|
|
|
|
#define ATIO2_TC_ATTR_ACAQ 4
|
|
|
|
#define ATIO2_TC_ATTR_UNTAGGED 5
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Continue Target I/O Entry structure
|
|
|
|
* Request from driver. The response from the
|
|
|
|
* ISP firmware is the same except that the last 18
|
|
|
|
* bytes are overwritten by suggested sense data if
|
|
|
|
* the 'autosense valid' bit is set in the status byte.
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
isphdr_t ct_header;
|
2001-03-14 08:46:50 +03:00
|
|
|
u_int16_t ct_reserved;
|
|
|
|
#define ct_syshandle ct_reserved /* we use this */
|
|
|
|
u_int16_t ct_fwhandle; /* required by f/w */
|
2000-01-05 22:50:05 +03:00
|
|
|
u_int8_t ct_lun; /* lun */
|
|
|
|
u_int8_t ct_iid; /* initiator id */
|
|
|
|
u_int8_t ct_reserved2;
|
|
|
|
u_int8_t ct_tgt; /* our target id */
|
|
|
|
u_int32_t ct_flags;
|
|
|
|
u_int8_t ct_status; /* isp status */
|
|
|
|
u_int8_t ct_scsi_status; /* scsi status */
|
|
|
|
u_int8_t ct_tag_val; /* tag value */
|
|
|
|
u_int8_t ct_tag_type; /* tag type */
|
|
|
|
u_int32_t ct_xfrlen; /* transfer length */
|
|
|
|
u_int32_t ct_resid; /* residual length */
|
|
|
|
u_int16_t ct_timeout;
|
|
|
|
u_int16_t ct_seg_count;
|
Major restructuring for swizzling to the request queue and unswizzling from
the response queue. Instead of the ad hoc ISP_SWIZZLE_REQUEST, we now have
a complete set of inline functions in isp_inline.h. Each platform is
responsible for providing just one of a set of ISP_IOX_{GET,PUT}{8,16,32}
macros.
The reason this needs to be done is that we need to have a single set of
functions that will work correctly on multiple architectures for both little
and big endian machines. It also needs to work correctly in the case that
we have the request or response queues in memory that has to be treated
specially (e.g., have ddi_dma_sync called on it for Solaris after we update
it or before we read from it).
One thing that falls out of this is that we no longer build requests in the
request queue itself. Instead, we build the request locally (e.g., on the
stack) and then as part of the swizzling operation, copy it to the request
queue entry we've allocated. I thought long and hard about whether this was
too expensive a change to make as it in a lot of cases requires an extra
copy. On balance, the flexbility is worth it. With any luck, the entry that
we build locally stays in a processor writeback cache (after all, it's only
64 bytes) so that the cost of actually flushing it to the memory area that is
the shared queue with the PCI device is not all that expensive. We may examine
this again and try to get clever in the future to try and avoid copies.
Another change that falls out of this is that MEMORYBARRIER should be taken
a lot more seriously. The macro ISP_ADD_REQUEST does a MEMORYBARRIER on the
entry being added. But there had been many other places this had been missing.
It's now very important that it be done.
For NetBSD, it does a ddi_dmamap_sync as appropriate. This gets us out of
the explicit ddi_dmamap_sync on the whole response queue that we did for SBus
cards at each interrupt.
Set things up so that platforms that cannot have an SBus don't get a lot of
the SBus code checks (dead coded out).
Additional changes:
Fix a longstanding buglet of sorts. When we get an entry via isp_getrqentry,
the iptr value that gets returned is the value we intend to eventually plug
into the ISP registers as the entry *one past* the last one we've written-
*not* the current entry we're updating. All along we've been calling sync
functions on the wrong index value. Argh. The 'fix' here is to rename all
'iptr' variables as 'nxti' to remember that this is the 'next' pointer-
not the current pointer.
Devote a single bit to mboxbsy- and set aside bits for output mbox registers
that we need to pick up- we can have at least one command which does not
have any defined output registers (MBOX_EXECUTE_FIRMWARE).
Explicitly decode GetAllNext SNS Response back *as* a GetAllNext response.
Otherwise, we won't unswizzle it correctly.
Nuke some additional __P macros.
2001-12-14 03:13:44 +03:00
|
|
|
/*
|
|
|
|
* This is so we can share tag name space with
|
|
|
|
* CTIO{2,3,4} with the minimum of pain.
|
|
|
|
*/
|
|
|
|
union {
|
|
|
|
ispds_t ct_a[ISP_RQDSEG];
|
|
|
|
} _u;
|
|
|
|
#define ct_dataseg _u.ct_a
|
2000-01-05 22:50:05 +03:00
|
|
|
} ct_entry_t;
|
|
|
|
|
2000-02-12 05:33:34 +03:00
|
|
|
/*
|
|
|
|
* For some of the dual port SCSI adapters, port (bus #) is reported
|
|
|
|
* in the MSbit of ct_iid. Bit fields are a bit too awkward here.
|
|
|
|
*
|
|
|
|
* Note that this does not apply to FC adapters at all which can and
|
|
|
|
* do report IIDs between 129 && 255 (these represent devices that have
|
|
|
|
* logged in across a SCSI fabric).
|
|
|
|
*/
|
|
|
|
#define GET_IID_VAL(x) (x & 0x3f)
|
|
|
|
#define GET_BUS_VAL(x) ((x >> 7) & 0x1)
|
2001-09-06 02:32:38 +04:00
|
|
|
#define SET_IID_VAL(y, x) y = ((y & ~0x3f) | (x & 0x3f))
|
|
|
|
#define SET_BUS_VAL(y, x) y = ((y & 0x3f) | ((x & 0x1) << 7))
|
2000-02-12 05:33:34 +03:00
|
|
|
|
2000-01-05 22:50:05 +03:00
|
|
|
/*
|
|
|
|
* ct_flags values
|
|
|
|
*/
|
2001-04-05 06:28:17 +04:00
|
|
|
#define CT_TQAE 0x00000002 /* bit 1, Tagged Queue Action enable */
|
2000-01-05 22:50:05 +03:00
|
|
|
#define CT_DATA_IN 0x00000040 /* bits 6&7, Data direction */
|
|
|
|
#define CT_DATA_OUT 0x00000080 /* bits 6&7, Data direction */
|
|
|
|
#define CT_NO_DATA 0x000000C0 /* bits 6&7, Data direction */
|
|
|
|
#define CT_CCINCR 0x00000100 /* bit 8, autoincrement atio count */
|
|
|
|
#define CT_DATAMASK 0x000000C0 /* bits 6&7, Data direction */
|
2000-07-20 02:19:23 +04:00
|
|
|
#define CT_INISYNCWIDE 0x00004000 /* bit 14, Do Sync/Wide Negotiation */
|
2000-01-05 22:50:05 +03:00
|
|
|
#define CT_NODISC 0x00008000 /* bit 15, Disconnects disabled */
|
|
|
|
#define CT_DSDP 0x01000000 /* bit 24, Disable Save Data Pointers */
|
|
|
|
#define CT_SENDRDP 0x04000000 /* bit 26, Send Restore Pointers msg */
|
|
|
|
#define CT_SENDSTATUS 0x80000000 /* bit 31, Send SCSI status byte */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ct_status values
|
|
|
|
* - set by the firmware when it returns the CTIO
|
|
|
|
*/
|
|
|
|
#define CT_OK 0x01 /* completed without error */
|
|
|
|
#define CT_ABORTED 0x02 /* aborted by host */
|
|
|
|
#define CT_ERR 0x04 /* see sense data for error */
|
|
|
|
#define CT_INVAL 0x06 /* request for disabled lun */
|
|
|
|
#define CT_NOPATH 0x07 /* invalid ITL nexus */
|
|
|
|
#define CT_INVRXID 0x08 /* (FC only) Invalid RX_ID */
|
2001-05-16 07:58:03 +04:00
|
|
|
#define CT_DATA_OVER 0x09 /* (FC only) Data Overrun */
|
2000-01-05 22:50:05 +03:00
|
|
|
#define CT_RSELTMO 0x0A /* reselection timeout after 2 tries */
|
|
|
|
#define CT_TIMEOUT 0x0B /* timed out */
|
|
|
|
#define CT_RESET 0x0E /* SCSI Bus Reset occurred */
|
2000-07-20 02:19:23 +04:00
|
|
|
#define CT_PARITY 0x0F /* Uncorrectable Parity Error */
|
2001-05-16 07:58:03 +04:00
|
|
|
#define CT_BUS_ERROR 0x10 /* (FC Only) DMA PCI Error */
|
2000-07-20 02:19:23 +04:00
|
|
|
#define CT_PANIC 0x13 /* Unrecoverable Error */
|
2000-01-05 22:50:05 +03:00
|
|
|
#define CT_PHASE_ERROR 0x14 /* Bus phase sequence error */
|
|
|
|
#define CT_BDR_MSG 0x17 /* Bus Device Reset msg received */
|
2001-05-16 07:58:03 +04:00
|
|
|
#define CT_DATA_UNDER 0x15 /* (FC only) Data Underrun */
|
2000-01-05 22:50:05 +03:00
|
|
|
#define CT_TERMINATED 0x19 /* due to Terminate Transfer mbox cmd */
|
|
|
|
#define CT_PORTNOTAVAIL 0x28 /* port not available */
|
|
|
|
#define CT_LOGOUT 0x29 /* port logout */
|
|
|
|
#define CT_PORTCHANGED 0x2A /* port changed */
|
2000-07-20 02:19:23 +04:00
|
|
|
#define CT_IDE 0x33 /* Initiator Detected Error */
|
2000-01-05 22:50:05 +03:00
|
|
|
#define CT_NOACK 0x35 /* Outstanding Immed. Notify. entry */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* When the firmware returns a CTIO entry, it may overwrite the last
|
|
|
|
* part of the structure with sense data. This starts at offset 0x2E
|
|
|
|
* into the entry, which is in the middle of ct_dataseg[1]. Rather
|
|
|
|
* than define a new struct for this, I'm just using the sense data
|
|
|
|
* offset.
|
|
|
|
*/
|
|
|
|
#define CTIO_SENSE_OFFSET 0x2E
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Entry length in u_longs. All entries are the same size so
|
|
|
|
* any one will do as the numerator.
|
|
|
|
*/
|
|
|
|
#define UINT32_ENTRY_SIZE (sizeof(at_entry_t)/sizeof(u_int32_t))
|
|
|
|
|
|
|
|
/*
|
|
|
|
* QLA2100 CTIO (type 2) entry
|
|
|
|
*/
|
|
|
|
#define MAXRESPLEN 26
|
|
|
|
typedef struct {
|
|
|
|
isphdr_t ct_header;
|
2001-03-14 08:46:50 +03:00
|
|
|
u_int16_t ct_reserved;
|
|
|
|
u_int16_t ct_fwhandle; /* just to match CTIO */
|
2002-05-17 22:49:42 +04:00
|
|
|
u_int8_t ct_lun; /* lun */
|
|
|
|
u_int8_t ct_iid; /* initiator id */
|
|
|
|
u_int16_t ct_rxid; /* response ID */
|
2000-01-05 22:50:05 +03:00
|
|
|
u_int16_t ct_flags;
|
|
|
|
u_int16_t ct_status; /* isp status */
|
|
|
|
u_int16_t ct_timeout;
|
|
|
|
u_int16_t ct_seg_count;
|
|
|
|
u_int32_t ct_reloff; /* relative offset */
|
2000-02-12 05:33:34 +03:00
|
|
|
int32_t ct_resid; /* residual length */
|
2000-01-05 22:50:05 +03:00
|
|
|
union {
|
|
|
|
/*
|
|
|
|
* The three different modes that the target driver
|
Major restructuring for swizzling to the request queue and unswizzling from
the response queue. Instead of the ad hoc ISP_SWIZZLE_REQUEST, we now have
a complete set of inline functions in isp_inline.h. Each platform is
responsible for providing just one of a set of ISP_IOX_{GET,PUT}{8,16,32}
macros.
The reason this needs to be done is that we need to have a single set of
functions that will work correctly on multiple architectures for both little
and big endian machines. It also needs to work correctly in the case that
we have the request or response queues in memory that has to be treated
specially (e.g., have ddi_dma_sync called on it for Solaris after we update
it or before we read from it).
One thing that falls out of this is that we no longer build requests in the
request queue itself. Instead, we build the request locally (e.g., on the
stack) and then as part of the swizzling operation, copy it to the request
queue entry we've allocated. I thought long and hard about whether this was
too expensive a change to make as it in a lot of cases requires an extra
copy. On balance, the flexbility is worth it. With any luck, the entry that
we build locally stays in a processor writeback cache (after all, it's only
64 bytes) so that the cost of actually flushing it to the memory area that is
the shared queue with the PCI device is not all that expensive. We may examine
this again and try to get clever in the future to try and avoid copies.
Another change that falls out of this is that MEMORYBARRIER should be taken
a lot more seriously. The macro ISP_ADD_REQUEST does a MEMORYBARRIER on the
entry being added. But there had been many other places this had been missing.
It's now very important that it be done.
For NetBSD, it does a ddi_dmamap_sync as appropriate. This gets us out of
the explicit ddi_dmamap_sync on the whole response queue that we did for SBus
cards at each interrupt.
Set things up so that platforms that cannot have an SBus don't get a lot of
the SBus code checks (dead coded out).
Additional changes:
Fix a longstanding buglet of sorts. When we get an entry via isp_getrqentry,
the iptr value that gets returned is the value we intend to eventually plug
into the ISP registers as the entry *one past* the last one we've written-
*not* the current entry we're updating. All along we've been calling sync
functions on the wrong index value. Argh. The 'fix' here is to rename all
'iptr' variables as 'nxti' to remember that this is the 'next' pointer-
not the current pointer.
Devote a single bit to mboxbsy- and set aside bits for output mbox registers
that we need to pick up- we can have at least one command which does not
have any defined output registers (MBOX_EXECUTE_FIRMWARE).
Explicitly decode GetAllNext SNS Response back *as* a GetAllNext response.
Otherwise, we won't unswizzle it correctly.
Nuke some additional __P macros.
2001-12-14 03:13:44 +03:00
|
|
|
* can set the CTIO{2,3,4} up as.
|
2000-01-05 22:50:05 +03:00
|
|
|
*
|
|
|
|
* The first is for sending FCP_DATA_IUs as well as
|
|
|
|
* (optionally) sending a terminal SCSI status FCP_RSP_IU.
|
|
|
|
*
|
|
|
|
* The second is for sending SCSI sense data in an FCP_RSP_IU.
|
|
|
|
* Note that no FCP_DATA_IUs will be sent.
|
|
|
|
*
|
|
|
|
* The third is for sending FCP_RSP_IUs as built specifically
|
|
|
|
* in system memory as located by the isp_dataseg.
|
|
|
|
*/
|
|
|
|
struct {
|
|
|
|
u_int32_t _reserved;
|
|
|
|
u_int16_t _reserved2;
|
|
|
|
u_int16_t ct_scsi_status;
|
|
|
|
u_int32_t ct_xfrlen;
|
Major restructuring for swizzling to the request queue and unswizzling from
the response queue. Instead of the ad hoc ISP_SWIZZLE_REQUEST, we now have
a complete set of inline functions in isp_inline.h. Each platform is
responsible for providing just one of a set of ISP_IOX_{GET,PUT}{8,16,32}
macros.
The reason this needs to be done is that we need to have a single set of
functions that will work correctly on multiple architectures for both little
and big endian machines. It also needs to work correctly in the case that
we have the request or response queues in memory that has to be treated
specially (e.g., have ddi_dma_sync called on it for Solaris after we update
it or before we read from it).
One thing that falls out of this is that we no longer build requests in the
request queue itself. Instead, we build the request locally (e.g., on the
stack) and then as part of the swizzling operation, copy it to the request
queue entry we've allocated. I thought long and hard about whether this was
too expensive a change to make as it in a lot of cases requires an extra
copy. On balance, the flexbility is worth it. With any luck, the entry that
we build locally stays in a processor writeback cache (after all, it's only
64 bytes) so that the cost of actually flushing it to the memory area that is
the shared queue with the PCI device is not all that expensive. We may examine
this again and try to get clever in the future to try and avoid copies.
Another change that falls out of this is that MEMORYBARRIER should be taken
a lot more seriously. The macro ISP_ADD_REQUEST does a MEMORYBARRIER on the
entry being added. But there had been many other places this had been missing.
It's now very important that it be done.
For NetBSD, it does a ddi_dmamap_sync as appropriate. This gets us out of
the explicit ddi_dmamap_sync on the whole response queue that we did for SBus
cards at each interrupt.
Set things up so that platforms that cannot have an SBus don't get a lot of
the SBus code checks (dead coded out).
Additional changes:
Fix a longstanding buglet of sorts. When we get an entry via isp_getrqentry,
the iptr value that gets returned is the value we intend to eventually plug
into the ISP registers as the entry *one past* the last one we've written-
*not* the current entry we're updating. All along we've been calling sync
functions on the wrong index value. Argh. The 'fix' here is to rename all
'iptr' variables as 'nxti' to remember that this is the 'next' pointer-
not the current pointer.
Devote a single bit to mboxbsy- and set aside bits for output mbox registers
that we need to pick up- we can have at least one command which does not
have any defined output registers (MBOX_EXECUTE_FIRMWARE).
Explicitly decode GetAllNext SNS Response back *as* a GetAllNext response.
Otherwise, we won't unswizzle it correctly.
Nuke some additional __P macros.
2001-12-14 03:13:44 +03:00
|
|
|
union {
|
|
|
|
ispds_t ct_a[ISP_RQDSEG_T2]; /* CTIO2 */
|
|
|
|
ispds64_t ct_b[ISP_RQDSEG_T3]; /* CTIO3 */
|
|
|
|
ispdslist_t ct_c; /* CTIO4 */
|
|
|
|
} _u;
|
|
|
|
#define ct_dataseg _u.ct_a
|
|
|
|
#define ct_dataseg64 _u.ct_b
|
|
|
|
#define ct_dslist _u.ct_c
|
2000-01-05 22:50:05 +03:00
|
|
|
} m0;
|
|
|
|
struct {
|
|
|
|
u_int16_t _reserved;
|
|
|
|
u_int16_t _reserved2;
|
|
|
|
u_int16_t ct_senselen;
|
|
|
|
u_int16_t ct_scsi_status;
|
|
|
|
u_int16_t ct_resplen;
|
|
|
|
u_int8_t ct_resp[MAXRESPLEN];
|
|
|
|
} m1;
|
|
|
|
struct {
|
|
|
|
u_int32_t _reserved;
|
|
|
|
u_int16_t _reserved2;
|
|
|
|
u_int16_t _reserved3;
|
|
|
|
u_int32_t ct_datalen;
|
|
|
|
ispds_t ct_fcp_rsp_iudata;
|
|
|
|
} m2;
|
|
|
|
/*
|
|
|
|
* CTIO2 returned from F/W...
|
|
|
|
*/
|
|
|
|
struct {
|
|
|
|
u_int32_t _reserved[4];
|
|
|
|
u_int16_t ct_scsi_status;
|
|
|
|
u_int8_t ct_sense[QLTM_SENSELEN];
|
|
|
|
} fw;
|
|
|
|
} rsp;
|
|
|
|
} ct2_entry_t;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ct_flags values for CTIO2
|
|
|
|
*/
|
|
|
|
#define CT2_FLAG_MMASK 0x0003
|
|
|
|
#define CT2_FLAG_MODE0 0x0000
|
|
|
|
#define CT2_FLAG_MODE1 0x0001
|
|
|
|
#define CT2_FLAG_MODE2 0x0002
|
|
|
|
#define CT2_DATA_IN CT_DATA_IN
|
|
|
|
#define CT2_DATA_OUT CT_DATA_OUT
|
|
|
|
#define CT2_NO_DATA CT_NO_DATA
|
|
|
|
#define CT2_DATAMASK CT_DATAMASK
|
|
|
|
#define CT2_CCINCR 0x0100
|
|
|
|
#define CT2_FASTPOST 0x0200
|
|
|
|
#define CT2_SENDSTATUS 0x8000
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ct_status values are (mostly) the same as that for ct_entry.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ct_scsi_status values- the low 8 bits are the normal SCSI status
|
|
|
|
* we know and love. The upper 8 bits are validity markers for FCP_RSP_IU
|
|
|
|
* fields.
|
|
|
|
*/
|
|
|
|
#define CT2_RSPLEN_VALID 0x0100
|
|
|
|
#define CT2_SNSLEN_VALID 0x0200
|
|
|
|
#define CT2_DATA_OVER 0x0400
|
|
|
|
#define CT2_DATA_UNDER 0x0800
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Debug macros
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define ISP_TDQE(isp, msg, idx, arg) \
|
2000-08-02 03:55:09 +04:00
|
|
|
if (isp->isp_dblev & ISP_LOGTDEBUG2) isp_print_qentry(isp, msg, idx, arg)
|
2000-01-05 22:50:05 +03:00
|
|
|
|
Major restructuring for swizzling to the request queue and unswizzling from
the response queue. Instead of the ad hoc ISP_SWIZZLE_REQUEST, we now have
a complete set of inline functions in isp_inline.h. Each platform is
responsible for providing just one of a set of ISP_IOX_{GET,PUT}{8,16,32}
macros.
The reason this needs to be done is that we need to have a single set of
functions that will work correctly on multiple architectures for both little
and big endian machines. It also needs to work correctly in the case that
we have the request or response queues in memory that has to be treated
specially (e.g., have ddi_dma_sync called on it for Solaris after we update
it or before we read from it).
One thing that falls out of this is that we no longer build requests in the
request queue itself. Instead, we build the request locally (e.g., on the
stack) and then as part of the swizzling operation, copy it to the request
queue entry we've allocated. I thought long and hard about whether this was
too expensive a change to make as it in a lot of cases requires an extra
copy. On balance, the flexbility is worth it. With any luck, the entry that
we build locally stays in a processor writeback cache (after all, it's only
64 bytes) so that the cost of actually flushing it to the memory area that is
the shared queue with the PCI device is not all that expensive. We may examine
this again and try to get clever in the future to try and avoid copies.
Another change that falls out of this is that MEMORYBARRIER should be taken
a lot more seriously. The macro ISP_ADD_REQUEST does a MEMORYBARRIER on the
entry being added. But there had been many other places this had been missing.
It's now very important that it be done.
For NetBSD, it does a ddi_dmamap_sync as appropriate. This gets us out of
the explicit ddi_dmamap_sync on the whole response queue that we did for SBus
cards at each interrupt.
Set things up so that platforms that cannot have an SBus don't get a lot of
the SBus code checks (dead coded out).
Additional changes:
Fix a longstanding buglet of sorts. When we get an entry via isp_getrqentry,
the iptr value that gets returned is the value we intend to eventually plug
into the ISP registers as the entry *one past* the last one we've written-
*not* the current entry we're updating. All along we've been calling sync
functions on the wrong index value. Argh. The 'fix' here is to rename all
'iptr' variables as 'nxti' to remember that this is the 'next' pointer-
not the current pointer.
Devote a single bit to mboxbsy- and set aside bits for output mbox registers
that we need to pick up- we can have at least one command which does not
have any defined output registers (MBOX_EXECUTE_FIRMWARE).
Explicitly decode GetAllNext SNS Response back *as* a GetAllNext response.
Otherwise, we won't unswizzle it correctly.
Nuke some additional __P macros.
2001-12-14 03:13:44 +03:00
|
|
|
#ifdef ISP_TARGET_FUNCTIONS
|
2000-01-05 22:50:05 +03:00
|
|
|
/*
|
Major restructuring for swizzling to the request queue and unswizzling from
the response queue. Instead of the ad hoc ISP_SWIZZLE_REQUEST, we now have
a complete set of inline functions in isp_inline.h. Each platform is
responsible for providing just one of a set of ISP_IOX_{GET,PUT}{8,16,32}
macros.
The reason this needs to be done is that we need to have a single set of
functions that will work correctly on multiple architectures for both little
and big endian machines. It also needs to work correctly in the case that
we have the request or response queues in memory that has to be treated
specially (e.g., have ddi_dma_sync called on it for Solaris after we update
it or before we read from it).
One thing that falls out of this is that we no longer build requests in the
request queue itself. Instead, we build the request locally (e.g., on the
stack) and then as part of the swizzling operation, copy it to the request
queue entry we've allocated. I thought long and hard about whether this was
too expensive a change to make as it in a lot of cases requires an extra
copy. On balance, the flexbility is worth it. With any luck, the entry that
we build locally stays in a processor writeback cache (after all, it's only
64 bytes) so that the cost of actually flushing it to the memory area that is
the shared queue with the PCI device is not all that expensive. We may examine
this again and try to get clever in the future to try and avoid copies.
Another change that falls out of this is that MEMORYBARRIER should be taken
a lot more seriously. The macro ISP_ADD_REQUEST does a MEMORYBARRIER on the
entry being added. But there had been many other places this had been missing.
It's now very important that it be done.
For NetBSD, it does a ddi_dmamap_sync as appropriate. This gets us out of
the explicit ddi_dmamap_sync on the whole response queue that we did for SBus
cards at each interrupt.
Set things up so that platforms that cannot have an SBus don't get a lot of
the SBus code checks (dead coded out).
Additional changes:
Fix a longstanding buglet of sorts. When we get an entry via isp_getrqentry,
the iptr value that gets returned is the value we intend to eventually plug
into the ISP registers as the entry *one past* the last one we've written-
*not* the current entry we're updating. All along we've been calling sync
functions on the wrong index value. Argh. The 'fix' here is to rename all
'iptr' variables as 'nxti' to remember that this is the 'next' pointer-
not the current pointer.
Devote a single bit to mboxbsy- and set aside bits for output mbox registers
that we need to pick up- we can have at least one command which does not
have any defined output registers (MBOX_EXECUTE_FIRMWARE).
Explicitly decode GetAllNext SNS Response back *as* a GetAllNext response.
Otherwise, we won't unswizzle it correctly.
Nuke some additional __P macros.
2001-12-14 03:13:44 +03:00
|
|
|
* The functions below are for the publicly available
|
|
|
|
* target mode functions that are internal to the Qlogic driver.
|
2000-01-05 22:50:05 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function handles new response queue entry appropriate for target mode.
|
|
|
|
*/
|
2001-03-14 08:46:50 +03:00
|
|
|
int isp_target_notify(struct ispsoftc *, void *, u_int16_t *);
|
2000-01-05 22:50:05 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Enable/Disable/Modify a logical unit.
|
2001-05-16 07:58:03 +04:00
|
|
|
* (softc, cmd, bus, tgt, lun, cmd_cnt, inotify_cnt, opaque)
|
2000-01-05 22:50:05 +03:00
|
|
|
*/
|
2001-05-16 07:58:03 +04:00
|
|
|
#define DFLT_CMND_CNT 32
|
|
|
|
#define DFLT_INOT_CNT 4
|
|
|
|
int isp_lun_cmd(struct ispsoftc *, int, int, int, int, int, int, u_int32_t);
|
2000-01-05 22:50:05 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* General request queue 'put' routine for target mode entries.
|
|
|
|
*/
|
2001-04-05 06:28:17 +04:00
|
|
|
int isp_target_put_entry(struct ispsoftc *isp, void *);
|
2000-01-05 22:50:05 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* General routine to put back an ATIO entry-
|
|
|
|
* used for replenishing f/w resource counts.
|
2001-04-05 06:28:17 +04:00
|
|
|
* The argument is a pointer to a source ATIO
|
|
|
|
* or ATIO2.
|
2000-01-05 22:50:05 +03:00
|
|
|
*/
|
2001-04-05 06:28:17 +04:00
|
|
|
int isp_target_put_atio(struct ispsoftc *, void *);
|
2000-01-05 22:50:05 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* General routine to send a final CTIO for a command- used mostly for
|
|
|
|
* local responses.
|
|
|
|
*/
|
2001-04-05 06:28:17 +04:00
|
|
|
int isp_endcmd(struct ispsoftc *, void *, u_int32_t, u_int16_t);
|
2000-02-12 05:33:34 +03:00
|
|
|
#define ECMD_SVALID 0x100
|
2000-01-05 22:50:05 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Handle an asynchronous event
|
2002-05-17 22:49:42 +04:00
|
|
|
*
|
|
|
|
* Return nonzero if the interrupt that generated this event has been dismissed.
|
2000-01-05 22:50:05 +03:00
|
|
|
*/
|
|
|
|
|
2002-05-17 22:49:42 +04:00
|
|
|
int isp_target_async(struct ispsoftc *, int, int);
|
Major restructuring for swizzling to the request queue and unswizzling from
the response queue. Instead of the ad hoc ISP_SWIZZLE_REQUEST, we now have
a complete set of inline functions in isp_inline.h. Each platform is
responsible for providing just one of a set of ISP_IOX_{GET,PUT}{8,16,32}
macros.
The reason this needs to be done is that we need to have a single set of
functions that will work correctly on multiple architectures for both little
and big endian machines. It also needs to work correctly in the case that
we have the request or response queues in memory that has to be treated
specially (e.g., have ddi_dma_sync called on it for Solaris after we update
it or before we read from it).
One thing that falls out of this is that we no longer build requests in the
request queue itself. Instead, we build the request locally (e.g., on the
stack) and then as part of the swizzling operation, copy it to the request
queue entry we've allocated. I thought long and hard about whether this was
too expensive a change to make as it in a lot of cases requires an extra
copy. On balance, the flexbility is worth it. With any luck, the entry that
we build locally stays in a processor writeback cache (after all, it's only
64 bytes) so that the cost of actually flushing it to the memory area that is
the shared queue with the PCI device is not all that expensive. We may examine
this again and try to get clever in the future to try and avoid copies.
Another change that falls out of this is that MEMORYBARRIER should be taken
a lot more seriously. The macro ISP_ADD_REQUEST does a MEMORYBARRIER on the
entry being added. But there had been many other places this had been missing.
It's now very important that it be done.
For NetBSD, it does a ddi_dmamap_sync as appropriate. This gets us out of
the explicit ddi_dmamap_sync on the whole response queue that we did for SBus
cards at each interrupt.
Set things up so that platforms that cannot have an SBus don't get a lot of
the SBus code checks (dead coded out).
Additional changes:
Fix a longstanding buglet of sorts. When we get an entry via isp_getrqentry,
the iptr value that gets returned is the value we intend to eventually plug
into the ISP registers as the entry *one past* the last one we've written-
*not* the current entry we're updating. All along we've been calling sync
functions on the wrong index value. Argh. The 'fix' here is to rename all
'iptr' variables as 'nxti' to remember that this is the 'next' pointer-
not the current pointer.
Devote a single bit to mboxbsy- and set aside bits for output mbox registers
that we need to pick up- we can have at least one command which does not
have any defined output registers (MBOX_EXECUTE_FIRMWARE).
Explicitly decode GetAllNext SNS Response back *as* a GetAllNext response.
Otherwise, we won't unswizzle it correctly.
Nuke some additional __P macros.
2001-12-14 03:13:44 +03:00
|
|
|
#endif
|
2001-03-14 08:46:50 +03:00
|
|
|
#endif /* _ISP_TARGET_H */
|