Clarify/cleanup how node and port names are derived from nvram. Remove

clause 2 of licence. Remember to print initiator ID (LOGINFO level).
This commit is contained in:
mjacob 2000-10-16 05:15:05 +00:00
parent 7cc31292b3
commit 298ec0ecd9

View File

@ -1,4 +1,4 @@
/* $NetBSD: isp.c,v 1.61 2000/08/16 18:10:21 mjacob Exp $ */
/* $NetBSD: isp.c,v 1.62 2000/10/16 05:15:05 mjacob Exp $ */
/*
* This driver, which is contained in NetBSD in the files:
*
@ -42,10 +42,7 @@
* 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.
* 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
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
@ -878,19 +875,18 @@ isp_scsi_init(isp)
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
return;
}
isp->isp_residx = 0;
isp->isp_residx = mbs.param[5];
mbs.param[0] = MBOX_INIT_REQ_QUEUE;
mbs.param[1] = RQUEST_QUEUE_LEN(isp);
mbs.param[2] = DMA_MSW(isp->isp_rquest_dma);
mbs.param[3] = DMA_LSW(isp->isp_rquest_dma);
mbs.param[4] = 0;
mbs.param[5] = 0;
isp_mboxcmd(isp, &mbs, MBLOGALL);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
return;
}
isp->isp_reqidx = isp->isp_reqodx = 0;
isp->isp_reqidx = isp->isp_reqodx = mbs.param[4];
/*
* Turn on Fast Posting, LVD transitions
@ -943,6 +939,8 @@ isp_scsi_channel_init(isp, channel)
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
return;
}
isp_prt(isp, ISP_LOGINFO, "Initiator ID is %d", sdp->isp_initiator_id);
/*
* Set current per-target parameters to a safe minimum.
@ -1032,6 +1030,7 @@ isp_fibre_init(isp)
isp_icb_t *icbp;
mbreg_t mbs;
int loopid;
u_int64_t nwwn, pwwn;
fcp = isp->isp_param;
@ -1115,10 +1114,19 @@ isp_fibre_init(isp)
}
icbp->icb_logintime = 60; /* 60 second login timeout */
if (fcp->isp_nodewwn) {
MAKE_NODE_NAME_FROM_WWN(icbp->icb_nodename, fcp->isp_nodewwn);
MAKE_NODE_NAME_FROM_WWN(icbp->icb_portname, fcp->isp_portwwn);
nwwn = ISP_NODEWWN(isp);
pwwn = ISP_PORTWWN(isp);
if (nwwn && pwwn) {
MAKE_NODE_NAME_FROM_WWN(icbp->icb_nodename, nwwn);
MAKE_NODE_NAME_FROM_WWN(icbp->icb_portname, pwwn);
isp_prt(isp, ISP_LOGDEBUG1,
"Setting ICB Node 0x%08x%08x Port 0x%08x%08x",
((u_int32_t) (nwwn >> 32)),
((u_int32_t) (nwwn & 0xffffffff)),
((u_int32_t) (pwwn >> 32)),
((u_int32_t) (pwwn & 0xffffffff)));
} else {
isp_prt(isp, ISP_LOGDEBUG1, "Not using any WWNs");
fcp->isp_fwoptions &= ~(ICBOPT_USE_PORTNAME|ICBOPT_FULL_LOGIN);
}
icbp->icb_rqstqlen = RQUEST_QUEUE_LEN(isp);
@ -4932,36 +4940,61 @@ isp_parse_nvram_2100(isp, nvram_data)
u_int64_t wwn;
/*
* There is supposed to be WWNN storage as distinct
* from WWPN storage in NVRAM, but it doesn't appear
* to be used sanely across all cards.
* There is NVRAM storage for both Port and Node entities-
* but the Node entity appears to be unused on all the cards
* I can find. However, we should account for this being set
* at some point in the future.
*
* Qlogic WWNs have an NAA of 2, but usually nothing shows up in
* bits 48..60. In the case of the 2202, it appears that they do
* use bit 48 to distinguish between the two instances on the card.
* The 2204, which I've never seen, *probably* extends this method.
*/
wwn = ISP2100_NVRAM_PORT_NAME(nvram_data);
if (wwn != 0LL) {
switch ((int) (wwn >> 60)) {
case 0:
/*
* Broken PTI cards with nothing in the top nibble. Pah.
*/
wwn |= (2LL << 60);
/* FALLTHROUGH */
case 2:
fcp->isp_nodewwn = wwn;
fcp->isp_nodewwn &= ~((0xfffLL) << 48);
fcp->isp_portwwn =
PORT_FROM_NODE_WWN(isp, fcp->isp_nodewwn);
break;
default:
fcp->isp_portwwn = fcp->isp_nodewwn = wwn;
if (wwn) {
isp_prt(isp, ISP_LOGCONFIG, "NVRAM Port WWN 0x%08x%08x",
(u_int32_t) (wwn >> 32), (u_int32_t) (wwn & 0xffffffff));
if ((wwn >> 60) == 0) {
wwn |= (((u_int64_t) 2)<< 60);
}
}
isp_prt(isp, ISP_LOGCONFIG, "NVRAM Derived Node WWN 0x%08x%08x",
(u_int32_t) (fcp->isp_nodewwn >> 32),
(u_int32_t) (fcp->isp_nodewwn & 0xffffffff));
isp_prt(isp, ISP_LOGCONFIG, "NVRAM Derived Port WWN 0x%08x%08x",
(u_int32_t) (fcp->isp_portwwn >> 32),
(u_int32_t) (fcp->isp_portwwn & 0xffffffff));
fcp->isp_portwwn = wwn;
wwn = ISP2100_NVRAM_NODE_NAME(nvram_data);
if (wwn) {
isp_prt(isp, ISP_LOGCONFIG, "NVRAM Node WWN 0x%08x%08x",
(u_int32_t) (wwn >> 32), (u_int32_t) (wwn & 0xffffffff));
if ((wwn >> 60) == 0) {
wwn |= (((u_int64_t) 2)<< 60);
}
}
fcp->isp_nodewwn = wwn;
/*
* Make sure we have both Node and Port as non-zero values.
*/
if (fcp->isp_nodewwn != 0 && fcp->isp_portwwn == 0) {
fcp->isp_portwwn = fcp->isp_nodewwn;
} else if (fcp->isp_nodewwn == 0 && fcp->isp_portwwn != 0) {
fcp->isp_nodewwn = fcp->isp_portwwn;
}
/*
* Make the Node and Port values sane if they're NAA == 2.
* This means to clear bits 48..56 for the Node WWN and
* make sure that there's some non-zero value in 48..56
* for the Port WWN.
*/
if (fcp->isp_nodewwn && fcp->isp_portwwn) {
if ((fcp->isp_nodewwn & (((u_int64_t) 0xfff) << 48)) != 0 &&
(fcp->isp_nodewwn >> 60) == 2) {
fcp->isp_nodewwn &= ~((u_int64_t) 0xfff << 48);
}
if ((fcp->isp_portwwn & (((u_int64_t) 0xfff) << 48)) == 0 &&
(fcp->isp_portwwn >> 60) == 2) {
fcp->isp_portwwn |= ((u_int64_t) 1 << 56);
}
}
fcp->isp_maxalloc =
ISP2100_NVRAM_MAXIOCBALLOCATION(nvram_data);
fcp->isp_maxfrmlen =
@ -4975,4 +5008,6 @@ isp_parse_nvram_2100(isp, nvram_data)
fcp->isp_execthrottle =
ISP2100_NVRAM_EXECUTION_THROTTLE(nvram_data);
fcp->isp_fwoptions = ISP2100_NVRAM_OPTIONS(nvram_data);
isp_prt(isp, ISP_LOGDEBUG0,
"fwoptions from nvram are 0x%x", fcp->isp_fwoptions);
}