diff options
author | gibbs <gibbs@FreeBSD.org> | 1998-09-15 08:42:56 +0000 |
---|---|---|
committer | gibbs <gibbs@FreeBSD.org> | 1998-09-15 08:42:56 +0000 |
commit | dbf36c8a08a76bae16c65addc3f0073e0310897c (patch) | |
tree | f1937b2a7cd6a9ebf69474e247af914f99a23395 /sys/dev/isp/ispvar.h | |
parent | 589d4a338b39b4f9e27060b9b9c717ae520f8905 (diff) | |
download | FreeBSD-src-dbf36c8a08a76bae16c65addc3f0073e0310897c.zip FreeBSD-src-dbf36c8a08a76bae16c65addc3f0073e0310897c.tar.gz |
Update QLogic ISP support for CAM. Add preliminary target mode support.
Submitted by: Matthew Jacob <mjacob@feral.com>
Diffstat (limited to 'sys/dev/isp/ispvar.h')
-rw-r--r-- | sys/dev/isp/ispvar.h | 173 |
1 files changed, 115 insertions, 58 deletions
diff --git a/sys/dev/isp/ispvar.h b/sys/dev/isp/ispvar.h index cda1eb6..ae8c9d4 100644 --- a/sys/dev/isp/ispvar.h +++ b/sys/dev/isp/ispvar.h @@ -1,4 +1,4 @@ -/* $Id: ispvar.h,v 1.2 1998/05/01 18:10:50 bde Exp $ */ +/* $Id: ispvar.h,v 1.17 1998/09/14 23:22:51 mjacob Exp $ */ /* * Soft Definitions for for Qlogic ISP SCSI adapters. * @@ -46,6 +46,9 @@ #include <ispmbox.h> #endif +#define ISP_CORE_VERSION_MAJOR 1 +#define ISP_CORE_VERSION_MINOR 3 + /* * Vector for MD code to provide specific services. */ @@ -73,29 +76,30 @@ struct ispmdvec { }; #define MAX_TARGETS 16 -#define MAX_LUNS 8 #define MAX_FC_TARG 126 -#define RQUEST_QUEUE_LEN(isp) MAXISPREQUEST -#define RESULT_QUEUE_LEN(isp) (MAXISPREQUEST/4) - -#define QENTRY_LEN 64 - -#define ISP_QUEUE_ENTRY(q, idx) ((q) + ((idx) * QENTRY_LEN)) -#define ISP_QUEUE_SIZE(n) ((n) * QENTRY_LEN) - +/* queue length must be a power of two */ +#define QENTRY_LEN 64 +#define RQUEST_QUEUE_LEN MAXISPREQUEST +#define RESULT_QUEUE_LEN (MAXISPREQUEST/4) +#define ISP_QUEUE_ENTRY(q, idx) ((q) + ((idx) * QENTRY_LEN)) +#define ISP_QUEUE_SIZE(n) ((n) * QENTRY_LEN) +#define ISP_NXT_QENTRY(idx, qlen) (((idx) + 1) & ((qlen)-1)) +#define ISP_QAVAIL(in, out, qlen) \ + ((in == out)? (qlen - 1) : ((in > out)? \ + ((qlen - 1) - (in - out)) : (out - in - 1))) /* * SCSI (as opposed to FC-PH) Specific Host Adapter Parameters */ typedef struct { - u_int isp_adapter_enabled : 1, - isp_req_ack_active_neg : 1, + u_int isp_req_ack_active_neg : 1, isp_data_line_active_neg: 1, isp_cmd_dma_burst_enable: 1, isp_data_dma_burst_enabl: 1, isp_fifo_threshold : 2, isp_diffmode : 1, + isp_fast_mttr : 1, isp_initiator_id : 4, isp_async_data_setup : 4; u_int16_t isp_selection_timeout; @@ -106,26 +110,32 @@ typedef struct { u_int8_t isp_retry_count; u_int8_t isp_retry_delay; struct { - u_int8_t dev_flags; /* Device Flags - see below */ - u_int8_t exc_throttle; - u_int8_t sync_period; - u_int sync_offset : 4, - dev_enable : 1; + u_int dev_update : 1, + dev_enable : 1, + exc_throttle : 7, + sync_offset : 4, + sync_period : 8; + u_int16_t dev_flags; /* persistent device flags */ + u_int16_t cur_dflags; /* current device flags */ } isp_devparam[MAX_TARGETS]; } sdparam; /* scsi device parameters */ /* * Device Flags */ -#define DPARM_DISC 0x80 -#define DPARM_PARITY 0x40 -#define DPARM_WIDE 0x20 -#define DPARM_SYNC 0x10 -#define DPARM_TQING 0x08 -#define DPARM_ARQ 0x04 -#define DPARM_QFRZ 0x02 -#define DPARM_RENEG 0x01 -#define DPARM_DEFAULT (0xff & ~DPARM_QFRZ) +#define DPARM_DISC 0x8000 +#define DPARM_PARITY 0x4000 +#define DPARM_WIDE 0x2000 +#define DPARM_SYNC 0x1000 +#define DPARM_TQING 0x0800 +#define DPARM_ARQ 0x0400 +#define DPARM_QFRZ 0x0200 +#define DPARM_RENEG 0x0100 +#define DPARM_NARROW 0x0080 /* Possibly only available with >= 7.55 fw */ +#define DPARM_ASYNC 0x0040 /* Possibly only available with >= 7.55 fw */ +#define DPARM_DEFAULT (0xFFFF & ~DPARM_QFRZ) +#define DPARM_SAFE_DFLT (DPARM_DEFAULT & ~(DPARM_WIDE|DPARM_SYNC|DPARM_TQING)) + #define ISP_20M_SYNCPARMS 0x080c #define ISP_10M_SYNCPARMS 0x0c19 @@ -138,11 +148,15 @@ typedef struct { */ typedef struct { u_int64_t isp_wwn; /* WWN of adapter */ - u_int8_t isp_loopid; /* FCAL of this adapter inst */ - u_int8_t isp_retry_count; + u_int8_t isp_loopid; /* hard loop id */ + u_int8_t isp_alpa; /* ALPA */ + u_int8_t isp_execthrottle; u_int8_t isp_retry_delay; + u_int8_t isp_retry_count; u_int8_t isp_fwstate; /* ISP F/W state */ - + u_int16_t isp_maxalloc; + u_int16_t isp_maxfrmlen; + u_int16_t isp_fwoptions; /* * Scratch DMA mapped in area to fetch Port Database stuff, etc. */ @@ -197,27 +211,37 @@ struct ispsoftc { * State, debugging, etc.. */ - u_int32_t isp_state : 3, - isp_dogactive : 1, - isp_dblev : 4, + u_int : 8, isp_confopts : 8, - isp_fwrev : 16; + : 2, + isp_dblev : 3, + isp_gotdparms : 1, + isp_dogactive : 1, + isp_bustype : 1, /* BUS Implementation */ + isp_type : 8; /* HBA Type and Revision */ + + u_int16_t isp_fwrev; /* Running F/W revision */ + u_int16_t isp_romfw_rev; /* 'ROM' F/W revision */ + void * isp_param; /* - * Host Adapter Type and Parameters. - * Some parameters nominally stored in NVRAM on card. + * Volatile state */ - void * isp_param; - u_int8_t isp_type; - int16_t isp_nactive; + + volatile u_int + : 19, + isp_state : 3, + isp_sendmarker : 1, /* send a marker entry */ + isp_update : 1, /* update paramters */ + isp_nactive : 9; /* how many commands active */ /* - * Result and Request Queues. + * Result and Request Queue indices. */ + volatile u_int8_t isp_reqodx; /* index of last ISP pickup */ volatile u_int8_t isp_reqidx; /* index of next request */ volatile u_int8_t isp_residx; /* index of next result */ - volatile u_int8_t isp_sendmarker; - volatile u_int8_t isp_seqno; + volatile u_int8_t isp_seqno; /* rolling sequence # */ /* * Sheer laziness, but it gets us around the problem @@ -228,10 +252,10 @@ struct ispsoftc { * jeez, so I blow a couple of KB per host adapter... * and it *is* faster. */ - volatile ISP_SCSI_XFER_T *isp_xflist[MAXISPREQUEST]; + volatile ISP_SCSI_XFER_T *isp_xflist[RQUEST_QUEUE_LEN]; /* - * request/result queues + * request/result queues and dma handles for them. */ volatile caddr_t isp_rquest; volatile caddr_t isp_result; @@ -252,14 +276,24 @@ struct ispsoftc { */ #define ISP_CFG_NORELOAD 0x80 /* don't download f/w */ +#define ISP_FW_REV(maj, min) ((maj) << 10| (min)) + +/* + * Bus (implementation) types + */ +#define ISP_BT_PCI 0 /* PCI Implementations */ +#define ISP_BT_SBUS 1 /* SBus Implementations */ + /* - * Adapter Types + * Chip Types */ #define ISP_HA_SCSI 0xf -#define ISP_HA_SCSI_UNKNOWN 0x0 -#define ISP_HA_SCSI_1020 0x1 -#define ISP_HA_SCSI_1040A 0x2 -#define ISP_HA_SCSI_1040B 0x3 +#define ISP_HA_SCSI_UNKNOWN 0x1 +#define ISP_HA_SCSI_1020 0x2 +#define ISP_HA_SCSI_1020A 0x3 +#define ISP_HA_SCSI_1040 0x4 +#define ISP_HA_SCSI_1040A 0x5 +#define ISP_HA_SCSI_1040B 0x6 #define ISP_HA_FC 0xf0 #define ISP_HA_FC_2100 0x10 @@ -301,19 +335,12 @@ struct ispsoftc { */ /* - * Reset Hardware. + * Reset Hardware. Totally. Assumes that you'll follow this with + * a call to isp_init. */ void isp_reset __P((struct ispsoftc *)); /* - * Abort this running command.. - * - * Second argument is an index into xflist array. - * All locks must be held already. - */ -int isp_abortcmd __P((struct ispsoftc *, int)); - -/* * Initialize Hardware to known state */ void isp_init __P((struct ispsoftc *)); @@ -324,6 +351,11 @@ void isp_init __P((struct ispsoftc *)); void isp_uninit __P((struct ispsoftc *)); /* + * Reset the ISP and call completion for any orphaned commands. + */ +void isp_restart __P((struct ispsoftc *)); + +/* * Interrupt Service Routine */ int isp_intr __P((void *)); @@ -336,6 +368,31 @@ void isp_watch __P((void *)); /* * Command Entry Point */ -extern int32_t ispscsicmd __P((ISP_SCSI_XFER_T *)); +int32_t ispscsicmd __P((ISP_SCSI_XFER_T *)); + +/* + * Platform Dependent to Internal Control Point + * + * For: Aborting a running command - arg is an ISP_SCSI_XFER_T * + * Resetting a Device - arg is target to reset + * Resetting a BUS - arg is ignored + * Updating parameters - arg is ignored + * + * Second argument is an index into xflist array. + * Assumes all locks must be held already. + */ +typedef enum { + ISPCTL_RESET_BUS, + ISPCTL_RESET_DEV, + ISPCTL_ABORT_CMD, + ISPCTL_UPDATE_PARAMS, +} ispctl_t; +int isp_control __P((struct ispsoftc *, ispctl_t, void *)); + +/* + * lost command routine (XXXX IN TRANSITION XXXX) + */ +void isp_lostcmd __P((struct ispsoftc *, ISP_SCSI_XFER_T *)); + #endif /* _ISPVAR_H */ |