Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Clean up a bit from the last checkin so that the ...



details:   https://anonhg.NetBSD.org/src/rev/832edf933f7a
branches:  trunk
changeset: 525412:832edf933f7a
user:      mjacob <mjacob%NetBSD.org@localhost>
date:      Thu Apr 11 02:32:03 2002 +0000

description:
Clean up a bit from the last checkin so that the correct result pointers
are used- didn't make a difference, but hey...

Put in commented out GFF_ID code- for use in future attempts to search
the fabric- this probably has to go thru the management server path.

Don't whine about handles we can't find if these are aborted commands
(we know we can't find the handles because we destroy handles after
a successful mailbox abort- we don't wait for the F/W to decide whether
it wants to return a status IOCB after this happens).

diffstat:

 sys/dev/ic/isp.c        |  115 +++++++++++++++++++++++++++++++++++++----------
 sys/dev/ic/isp_inline.h |   17 ++++++-
 sys/dev/ic/ispmbox.h    |    8 ++-
 3 files changed, 114 insertions(+), 26 deletions(-)

diffs (284 lines):

diff -r 240b60e7e8e6 -r 832edf933f7a sys/dev/ic/isp.c
--- a/sys/dev/ic/isp.c  Wed Apr 10 23:51:06 2002 +0000
+++ b/sys/dev/ic/isp.c  Thu Apr 11 02:32:03 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp.c,v 1.91 2002/04/04 23:38:43 mjacob Exp $ */
+/* $NetBSD: isp.c,v 1.92 2002/04/11 02:32:03 mjacob Exp $ */
 /*
  * This driver, which is contained in NetBSD in the files:
  *
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isp.c,v 1.91 2002/04/04 23:38:43 mjacob Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp.c,v 1.92 2002/04/11 02:32:03 mjacob Exp $");
 
 #ifdef __NetBSD__
 #include <dev/ic/isp_netbsd.h>
@@ -1850,7 +1850,7 @@
                 * that has, in fact, gone away. And it hangs trying to
                 * log it out.
                 */
-               if (lp->loggedin &&
+               if (lp->loggedin && lp->force_logout == 0 &&
                    isp_getpdb(isp, lp->loopid, &pdb) == 0) {
                        int nrole;
                        u_int64_t nwwnn, nwwpn;
@@ -1886,8 +1886,6 @@
                        }
                }
 
-               lp->force_logout = 0;
-
                if (fcp->isp_fwstate != FW_READY ||
                    fcp->isp_loopstate != LOOP_SYNCING_PDB) {
                        return (-1);
@@ -1897,18 +1895,18 @@
                 * Force a logout if we were logged in.
                 */
                if (lp->loggedin) {
-                       if (isp_getpdb(isp, lp->loopid, &pdb) == 0) {
+                       if (lp->force_logout ||
+                           isp_getpdb(isp, lp->loopid, &pdb) == 0) {
                                mbs.param[0] = MBOX_FABRIC_LOGOUT;
                                mbs.param[1] = lp->loopid << 8;
                                mbs.param[2] = 0;
                                mbs.param[3] = 0;
                                isp_mboxcmd(isp, &mbs, MBLOGNONE);
-                               lp->loggedin = 0;
                                isp_prt(isp, ISP_LOGINFO, plogout,
                                    (int) (lp - fcp->portdb), lp->loopid,
                                    lp->portid);
                        }
-                       lp->loggedin = 0;
+                       lp->force_logout = lp->loggedin = 0;
                        if (fcp->isp_fwstate != FW_READY ||
                            fcp->isp_loopstate != LOOP_SYNCING_PDB) {
                                return (-1);
@@ -2540,7 +2538,6 @@
 {
        fcparam *fcp = FCPARAM(isp);
        mbreg_t mbs;
-       u_int8_t sc[GIDLEN];    /* XXX USE ->tport */
        int i;
        sns_gid_ft_req_t *rq;
        sns_gid_ft_rsp_t *rs0, *rs1;
@@ -2553,7 +2550,7 @@
        FC_SCRATCH_ACQUIRE(isp);
        fcp->isp_loopstate = LOOP_SCANNING_FABRIC;
 
-       rq = (sns_gid_ft_req_t *)sc;
+       rq = (sns_gid_ft_req_t *)fcp->tport;
        MEMZERO((void *) rq, SNS_GID_FT_REQ_SIZE);
        rq->snscb_rblen = GIDLEN >> 1;
        rq->snscb_addr[RQRSP_ADDR0015] = DMA_WD0(fcp->isp_scdma+IGPOFF);
@@ -2588,7 +2585,7 @@
                return (-1);
        }
        MEMORYBARRIER(isp, SYNC_SFORCPU, IGPOFF, GIDLEN);
-       rs1 = (sns_gid_ft_rsp_t *) sc;
+       rs1 = (sns_gid_ft_rsp_t *) fcp->tport;
        rs0 = (sns_gid_ft_rsp_t *) ((u_int8_t *)fcp->isp_scratch+IGPOFF);
        isp_get_gid_ft_response(isp, rs0, rs1, NGENT);
        if (rs1->snscb_cthdr.ct_response != FS_ACC) {
@@ -2613,6 +2610,9 @@
                sns_gxn_id_req_t grqbuf, *gq = &grqbuf;
                sns_gxn_id_rsp_t *gs0, grsbuf, *gs1 = &grsbuf;
                struct lportdb lcl;
+#if    0
+               sns_gff_id_rsp_t *fs0, ffsbuf, *fs1 = &ffsbuf;
+#endif
 
                i++;
                MEMZERO(&lcl, sizeof (lcl));
@@ -2659,8 +2659,8 @@
                isp_get_gxn_id_response(isp, gs0, gs1);
                if (gs1->snscb_cthdr.ct_response != FS_ACC) {
                        isp_prt(isp, ISP_LOGWARN, swrej, "GPN_ID",
-                           rs1->snscb_cthdr.ct_reason,
-                           rs1->snscb_cthdr.ct_explanation, lcl.portid);
+                           gs1->snscb_cthdr.ct_reason,
+                           gs1->snscb_cthdr.ct_explanation, lcl.portid);
                        if (fcp->isp_loopstate != LOOP_SCANNING_FABRIC) {
                                FC_SCRATCH_RELEASE(isp);
                                return (-1);
@@ -2714,8 +2714,8 @@
                isp_get_gxn_id_response(isp, gs0, gs1);
                if (gs1->snscb_cthdr.ct_response != FS_ACC) {
                        isp_prt(isp, ISP_LOGWARN, swrej, "GNN_ID",
-                           rs1->snscb_cthdr.ct_reason,
-                           rs1->snscb_cthdr.ct_explanation, lcl.portid);
+                           gs1->snscb_cthdr.ct_reason,
+                           gs1->snscb_cthdr.ct_explanation, lcl.portid);
                        if (fcp->isp_loopstate != LOOP_SCANNING_FABRIC) {
                                FC_SCRATCH_RELEASE(isp);
                                return (-1);
@@ -2733,13 +2733,72 @@
                    (((u_int64_t)gs1->snscb_wwn[7]));
 
                /*
-                * XXX: Argh! I saw some PDF which I now can't find that
-                * XXX: had proposed that the bottom nibble of CONTROL
-                * XXX: would have the SCSI-FCP role flags, which would
-                * XXX: be *awesome*.
-                *
-               lcl.roles = rs1->snscb_port[i].control & 0xf;
+                * The QLogic f/w is bouncing this with a parameter error.
+                */
+#if    0
+               /*
+                * Try and get FC4 Features (FC-GS-3 only).
+                * We can use the sns_gxn_id_req_t for this request.
+                */
+               MEMZERO((void *) gq, sizeof (sns_gxn_id_req_t));
+               gq->snscb_rblen = SNS_GFF_ID_RESP_SIZE >> 1;
+               gq->snscb_addr[RQRSP_ADDR0015] = DMA_WD0(fcp->isp_scdma+GXOFF);
+               gq->snscb_addr[RQRSP_ADDR1631] = DMA_WD1(fcp->isp_scdma+GXOFF);
+               gq->snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma+GXOFF);
+               gq->snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma+GXOFF);
+               gq->snscb_sblen = 6;
+               gq->snscb_cmd = SNS_GFF_ID;
+               gq->snscb_portid = lcl.portid;
+               isp_put_gxn_id_request(isp, gq,
+                   (sns_gxn_id_req_t *) fcp->isp_scratch);
+               MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GXN_ID_REQ_SIZE);
+               mbs.param[0] = MBOX_SEND_SNS;
+               mbs.param[1] = SNS_GXN_ID_REQ_SIZE >> 1;
+               mbs.param[2] = DMA_WD1(fcp->isp_scdma);
+               mbs.param[3] = DMA_WD0(fcp->isp_scdma);
+               /*
+                * Leave 4 and 5 alone
                 */
+               mbs.param[6] = DMA_WD3(fcp->isp_scdma);
+               mbs.param[7] = DMA_WD2(fcp->isp_scdma);
+               if (isp_fabric_mbox_cmd(isp, &mbs)) {
+                       if (fcp->isp_loopstate >= LOOP_SCANNING_FABRIC) {
+                               fcp->isp_loopstate = LOOP_PDB_RCVD;
+                       }
+                       FC_SCRATCH_RELEASE(isp);
+                       return (-1);
+               }
+               if (fcp->isp_loopstate != LOOP_SCANNING_FABRIC) {
+                       FC_SCRATCH_RELEASE(isp);
+                       return (-1);
+               }
+               MEMORYBARRIER(isp, SYNC_SFORCPU, GXOFF, SNS_GFF_ID_RESP_SIZE);
+               fs0 = (sns_gff_id_rsp_t *) ((u_int8_t *)fcp->isp_scratch+GXOFF);
+               isp_get_gff_id_response(isp, fs0, fs1);
+               if (fs1->snscb_cthdr.ct_response != FS_ACC) {
+                       isp_prt(isp, /* ISP_LOGDEBUG0 */ ISP_LOGWARN,
+                           swrej, "GFF_ID",
+                           fs1->snscb_cthdr.ct_reason,
+                           fs1->snscb_cthdr.ct_explanation, lcl.portid);
+                       if (fcp->isp_loopstate != LOOP_SCANNING_FABRIC) {
+                               FC_SCRATCH_RELEASE(isp);
+                               return (-1);
+                       }
+               } else {
+                       int index = (ftype >> 3);
+                       int bshft = (ftype & 0x7) * 4;
+                       int fc4_fval =
+                           (fs1->snscb_fc4_features[index] >> bshft) & 0xf;
+                       if (fc4_fval & 0x1) {
+                               lcl.roles |=
+                                   (SVC3_INI_ROLE >> SVC3_ROLE_SHIFT);
+                       }
+                       if (fc4_fval & 0x2) {
+                               lcl.roles |=
+                                   (SVC3_TGT_ROLE >> SVC3_ROLE_SHIFT);
+                       }
+               }
+#endif
 
                /*
                 * If we really want to know what kind of port type this is,
@@ -3633,10 +3692,18 @@
                }
                xs = isp_find_xs(isp, sp->req_handle);
                if (xs == NULL) {
+                       u_int8_t ts = sp->req_completion_status & 0xff;
                        MEMZERO(hp, QENTRY_LEN);        /* PERF */
-                       isp_prt(isp, ISP_LOGERR,
-                           "cannot find handle 0x%x in xflist",
-                           sp->req_handle);
+                       /*
+                        * Only whine if this isn't the expected fallout of
+                        * aborting the command.
+                        */
+                       if (sp->req_header.rqs_entry_type != RQSTYPE_RESPONSE ||
+                           ts != RQCS_ABORTED) {
+                               isp_prt(isp, ISP_LOGERR,
+                                   "cannot find handle 0x%x in xflist",
+                                   sp->req_handle);
+                       }
                        WRITE_RESPONSE_QUEUE_OUT_POINTER(isp, optr);
                        continue;
                }
diff -r 240b60e7e8e6 -r 832edf933f7a sys/dev/ic/isp_inline.h
--- a/sys/dev/ic/isp_inline.h   Wed Apr 10 23:51:06 2002 +0000
+++ b/sys/dev/ic/isp_inline.h   Thu Apr 11 02:32:03 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_inline.h,v 1.19 2002/04/05 02:09:39 mjacob Exp $ */
+/* $NetBSD: isp_inline.h,v 1.20 2002/04/11 02:32:05 mjacob Exp $ */
 /*
  * This driver, which is contained in NetBSD in the files:
  *
@@ -321,6 +321,9 @@
 isp_get_gxn_id_response(struct ispsoftc *, sns_gxn_id_rsp_t *,
     sns_gxn_id_rsp_t *);
 static INLINE void
+isp_get_gff_id_response(struct ispsoftc *, sns_gff_id_rsp_t *,
+    sns_gff_id_rsp_t *);
+static INLINE void
 isp_get_ga_nxt_response(struct ispsoftc *, sns_ga_nxt_rsp_t *,
     sns_ga_nxt_rsp_t *);
 #ifdef ISP_TARGET_MODE
@@ -853,6 +856,18 @@
 }
 
 static INLINE void
+isp_get_gff_id_response(struct ispsoftc *isp, sns_gff_id_rsp_t *src,
+    sns_gff_id_rsp_t *dst)
+{
+       int i;
+       isp_get_ct_hdr(isp, &src->snscb_cthdr, &dst->snscb_cthdr);
+       for (i = 0; i < 32; i++) {
+               ISP_IOXGET_32(isp, &src->snscb_fc4_features[i],
+                   dst->snscb_fc4_features[i]);
+       }
+}
+
+static INLINE void
 isp_get_ga_nxt_response(struct ispsoftc *isp, sns_ga_nxt_rsp_t *src,
     sns_ga_nxt_rsp_t *dst)
 {
diff -r 240b60e7e8e6 -r 832edf933f7a sys/dev/ic/ispmbox.h
--- a/sys/dev/ic/ispmbox.h      Wed Apr 10 23:51:06 2002 +0000
+++ b/sys/dev/ic/ispmbox.h      Thu Apr 11 02:32:03 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ispmbox.h,v 1.39 2002/04/04 23:38:49 mjacob Exp $ */
+/* $NetBSD: ispmbox.h,v 1.40 2002/04/11 02:32:05 mjacob Exp $ */
 /*
  * This driver, which is contained in NetBSD in the files:
  *
@@ -835,6 +835,7 @@
 #define        SNS_GA_NXT      0x100
 #define        SNS_GPN_ID      0x112
 #define        SNS_GNN_ID      0x113
+#define        SNS_GFF_ID      0x11F
 #define        SNS_GID_FT      0x171
 #define        SNS_RFT_ID      0x217
 typedef struct {
@@ -933,6 +934,11 @@
 } sns_gxn_id_rsp_t;
 #define        SNS_GXN_ID_RESP_SIZE    (sizeof (sns_gxn_id_rsp_t))
 
+typedef struct {
+       ct_hdr_t        snscb_cthdr;
+       u_int32_t       snscb_fc4_features[32];
+} sns_gff_id_rsp_t;
+#define        SNS_GFF_ID_RESP_SIZE    (sizeof (sns_gff_id_rsp_t))
 
 typedef struct {
        ct_hdr_t        snscb_cthdr;



Home | Main Index | Thread Index | Old Index