Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/sys/dev/ic Pull up revisions 1.21-1.28 (requested by mj...
details: https://anonhg.NetBSD.org/src/rev/0538265c9d38
branches: netbsd-1-4
changeset: 470014:0538265c9d38
user: he <he%NetBSD.org@localhost>
date: Sat Jan 08 22:42:09 2000 +0000
description:
Pull up revisions 1.21-1.28 (requested by mjacob):
Untangle Qlogic firmware copyright problems and update firmware.
Untangle some MD support issues for said firmware. Add 1280 (Dual
LVD), 1240 (Dual Ultra), 2200 (2nd Generation Qlogic FC chipset).
Fix some synchronous negotiation problems for parallel SCSI.
Firm up some Fabric Support issues.
diffstat:
sys/dev/ic/ispvar.h | 449 ++++++++++++++++++++++++++-------------------------
1 files changed, 227 insertions(+), 222 deletions(-)
diffs (truncated from 636 to 300 lines):
diff -r 7bea12708366 -r 0538265c9d38 sys/dev/ic/ispvar.h
--- a/sys/dev/ic/ispvar.h Sat Jan 08 22:41:45 2000 +0000
+++ b/sys/dev/ic/ispvar.h Sat Jan 08 22:42:09 2000 +0000
@@ -1,54 +1,59 @@
-/* $NetBSD: ispvar.h,v 1.20 1999/03/26 22:39:45 mjacob Exp $ */
-/* release_03_25_99 */
+/* $NetBSD: ispvar.h,v 1.20.2.1 2000/01/08 22:42:09 he Exp $ */
/*
- * Soft Definitions for for Qlogic ISP SCSI adapters.
+ * Copyright (C) 1999 National Aeronautics & Space Administration
+ * All rights reserved.
*
- *---------------------------------------
- * Copyright (c) 1997, 1998 by Matthew Jacob
- * NASA/Ames Research Center
- * 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.
+ * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
+ * 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
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * 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.
- *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 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.
*/
+/*
+ * Soft Definitions for for Qlogic ISP SCSI adapters.
+ * Matthew Jacob <mjacob%nas.nasa.gov@localhost>
+ */
#ifndef _ISPVAR_H
#define _ISPVAR_H
#if defined(__NetBSD__) || defined(__OpenBSD__)
#include <dev/ic/ispmbox.h>
+#ifdef ISP_TARGET_MODE
+#include <dev/ic/isp_target.h>
+#endif
#endif
#ifdef __FreeBSD__
#include <dev/isp/ispmbox.h>
+#ifdef ISP_TARGET_MODE
+#include <dev/isp/isp_target.h>
+#endif
#endif
#ifdef __linux__
#include "ispmbox.h"
+#ifdef ISP_TARGET_MODE
+#include "isp_target.h"
+#endif
#endif
#define ISP_CORE_VERSION_MAJOR 1
-#define ISP_CORE_VERSION_MINOR 7
+#define ISP_CORE_VERSION_MINOR 12
/*
* Vector for bus specific code to provide specific services.
@@ -59,7 +64,7 @@
void (*dv_wr_reg) __P((struct ispsoftc *, int, u_int16_t));
int (*dv_mbxdma) __P((struct ispsoftc *));
int (*dv_dmaset) __P((struct ispsoftc *,
- ISP_SCSI_XFER_T *, ispreq_t *, u_int8_t *, u_int8_t));
+ ISP_SCSI_XFER_T *, ispreq_t *, u_int16_t *, u_int16_t));
void (*dv_dmaclr)
__P((struct ispsoftc *, ISP_SCSI_XFER_T *, u_int32_t));
void (*dv_reset0) __P((struct ispsoftc *));
@@ -68,7 +73,7 @@
const u_int16_t *dv_ispfw; /* ptr to f/w */
u_int16_t dv_fwlen; /* length of f/w */
u_int16_t dv_codeorg; /* code ORG for f/w */
- u_int16_t dv_fwrev; /* f/w revision */
+ u_int32_t dv_fwrev; /* f/w revision */
/*
* Initial values for conf1 register
*/
@@ -82,45 +87,98 @@
#else
#define MAX_FC_TARG 126
#endif
-#define DEFAULT_LOOPID 113
+
+#define ISP_MAX_TARGETS(isp) (IS_FC(isp)? MAX_FC_TARG : MAX_TARGETS)
+#ifdef ISP2100_SCCLUN
+#define _ISP_FC_LUN(isp) 65536
+#else
+#define _ISP_FC_LUN(isp) 16
+#endif
+#define _ISP_SCSI_LUN(isp) \
+ ((ISP_FW_REVX(isp->isp_fwrev) >= ISP_FW_REV(7, 55, 0))? 32 : 8)
+#define ISP_MAX_LUNS(isp) \
+ (IS_FC(isp)? _ISP_FC_LUN(isp) : _ISP_SCSI_LUN(isp))
+
+
+/*
+ * Macros to read, write ISP registers through bus specific code.
+ */
+
+#define ISP_READ(isp, reg) \
+ (*(isp)->isp_mdvec->dv_rd_reg)((isp), (reg))
+
+#define ISP_WRITE(isp, reg, val) \
+ (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), (val))
+
+#define ISP_MBOXDMASETUP(isp) \
+ (*(isp)->isp_mdvec->dv_mbxdma)((isp))
-/* queue length must be a power of two */
+#define ISP_DMASETUP(isp, xs, req, iptrp, optr) \
+ (*(isp)->isp_mdvec->dv_dmaset)((isp), (xs), (req), (iptrp), (optr))
+
+#define ISP_DMAFREE(isp, xs, hndl) \
+ if ((isp)->isp_mdvec->dv_dmaclr) \
+ (*(isp)->isp_mdvec->dv_dmaclr)((isp), (xs), (hndl))
+
+#define ISP_RESET0(isp) \
+ if ((isp)->isp_mdvec->dv_reset0) (*(isp)->isp_mdvec->dv_reset0)((isp))
+#define ISP_RESET1(isp) \
+ if ((isp)->isp_mdvec->dv_reset1) (*(isp)->isp_mdvec->dv_reset1)((isp))
+#define ISP_DUMPREGS(isp) \
+ if ((isp)->isp_mdvec->dv_dregs) (*(isp)->isp_mdvec->dv_dregs)((isp))
+
+#define ISP_SETBITS(isp, reg, val) \
+ (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), ISP_READ((isp), (reg)) | (val))
+
+#define ISP_CLRBITS(isp, reg, val) \
+ (*(isp)->isp_mdvec->dv_wr_reg)((isp), (reg), ISP_READ((isp), (reg)) & ~(val))
+
+/* this is the size of a queue entry (request and response) */
#define QENTRY_LEN 64
+/* both request and result queue length must be a power of two */
#define RQUEST_QUEUE_LEN MAXISPREQUEST
+/* I've seen wierdnesses with the result queue < 64 */
+#if MAXISPREQUEST > 64
#define RESULT_QUEUE_LEN (MAXISPREQUEST/2)
+#else
+#define RESULT_QUEUE_LEN MAXISPREQUEST
+#endif
#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) \
+#define ISP_QAVAIL(in, out, qlen) \
((in == out)? (qlen - 1) : ((in > out)? \
- ((qlen - 1) - (in - out)) : (out - in - 1)))
+ ((qlen - 1) - (in - out)) : (out - in - 1)))
+
+#define ISP_ADD_REQUEST(isp, iptr) \
+ ISP_WRITE(isp, INMAILBOX4, iptr), isp->isp_reqidx = iptr
+
/*
- * SCSI Specific Host Adapter Parameters
+ * SCSI Specific Host Adapter Parameters- per bus, per target
*/
typedef struct {
- u_int isp_req_ack_active_neg : 1,
- isp_data_line_active_neg: 1,
+ u_int isp_gotdparms : 1,
+ 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 : 3,
isp_ultramode : 1,
isp_diffmode : 1,
isp_lvdmode : 1,
- isp_fast_mttr : 1,
+ : 1,
isp_initiator_id : 4,
- isp_async_data_setup : 4;
- u_int16_t isp_selection_timeout;
- u_int16_t isp_max_queue_depth;
- u_int16_t isp_clock;
+ isp_async_data_setup : 4;
+ u_int16_t isp_selection_timeout;
+ u_int16_t isp_max_queue_depth;
u_int8_t isp_tag_aging;
- u_int8_t isp_bus_reset_delay;
- u_int8_t isp_retry_count;
- u_int8_t isp_retry_delay;
+ u_int8_t isp_bus_reset_delay;
+ u_int8_t isp_retry_count;
+ u_int8_t isp_retry_delay;
struct {
- u_int
- dev_enable : 1,
- dev_announced : 1,
+ u_int dev_enable : 1, /* ignored */
+ : 1,
dev_update : 1,
dev_refresh : 1,
exc_throttle : 8,
@@ -131,7 +189,7 @@
u_int16_t dev_flags; /* goal device flags */
u_int16_t cur_dflags; /* current device flags */
} isp_devparam[MAX_TARGETS];
-} sdparam; /* scsi device parameters */
+} sdparam;
/*
* Device Flags
@@ -152,84 +210,80 @@
/* technically, not really correct, as they need to be rated based upon clock */
#define ISP_40M_SYNCPARMS 0x080a
-#define ISP_20M_SYNCPARMS 0x080c
-#define ISP_10M_SYNCPARMS 0x0c19
-#define ISP_08M_SYNCPARMS 0x0c25
-#define ISP_05M_SYNCPARMS 0x0c32
-#define ISP_04M_SYNCPARMS 0x0c41
+#define ISP_20M_SYNCPARMS 0x080c
+#define ISP_10M_SYNCPARMS 0x0c19
+#define ISP_08M_SYNCPARMS 0x0c25
+#define ISP_05M_SYNCPARMS 0x0c32
+#define ISP_04M_SYNCPARMS 0x0c41
/*
* Fibre Channel Specifics
*/
+#define FL_PORT_ID 0x7e /* FL_Port Special ID */
+#define FC_PORT_ID 0x7f /* Fabric Controller Special ID */
+#define FC_SNS_ID 0x80 /* SNS Server Special ID */
+
typedef struct {
- u_int64_t isp_wwn; /* WWN of adapter */
+ u_int32_t isp_fwoptions : 16,
+ : 7,
+ loop_seen_once : 1,
+ isp_loopstate : 3, /* Current Loop State */
+ isp_fwstate : 3, /* ISP F/W state */
+ isp_gotdparms : 1,
+ isp_onfabric : 1;
u_int8_t isp_loopid; /* hard loop id */
u_int8_t isp_alpa; /* ALPA */
+ volatile u_int16_t isp_lipseq; /* LIP sequence # */
+ u_int32_t isp_portid;
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_int8_t isp_retry_delay;
+ u_int8_t isp_retry_count;
+ u_int8_t isp_reserved;
u_int16_t isp_maxalloc;
u_int16_t isp_maxfrmlen;
- u_int16_t isp_fwoptions;
+ u_int64_t isp_nodewwn;
+ u_int64_t isp_portwwn;
/*
- * Port Data Base
+ * Port Data Base. This is indexed by 'target', which is invariate.
+ * However, elements within can move around due to loop changes,
+ * so the actual loop ID passed to the F/W is in this structure.
+ * The first time the loop is seen up, loopid will match the index
+ * (except for fabric nodes which are above mapped above FC_SNS_ID
+ * and are completely virtual), but subsequent LIPs can cause things
+ * to move around.
*/
- isp_pdb_t isp_pdb[MAX_FC_TARG];
+ struct lportdb {
+ u_int
+ loopid : 8,
+ : 4,
+ fabdev : 1,
+ roles : 2,
+ valid : 1;
+ u_int32_t portid;
+ u_int64_t node_wwn;
+ u_int64_t port_wwn;
+ } portdb[MAX_FC_TARG], tport[FL_PORT_ID];
Home |
Main Index |
Thread Index |
Old Index