1999-08-28 01:08:13 +00:00
|
|
|
/* $FreeBSD$ */
|
1998-04-22 17:54:58 +00:00
|
|
|
/*
|
1998-09-15 08:42:56 +00:00
|
|
|
* Machine and OS Independent (well, as best as possible)
|
1998-04-22 17:54:58 +00:00
|
|
|
* code for the Qlogic ISP SCSI adapters.
|
|
|
|
*
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
* Copyright (c) 1997, 1998, 1999 by Matthew Jacob
|
1998-04-22 17:54:58 +00:00
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Inspiration and ideas about this driver are from Erik Moe's Linux driver
|
|
|
|
* (qlogicisp.c) and Dave Miller's SBus version of same (qlogicisp.c). Some
|
|
|
|
* ideas dredged from the Solaris driver.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Include header file appropriate for platform we're building on.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __NetBSD__
|
|
|
|
#include <dev/ic/isp_netbsd.h>
|
|
|
|
#endif
|
|
|
|
#ifdef __FreeBSD__
|
|
|
|
#include <dev/isp/isp_freebsd.h>
|
|
|
|
#endif
|
1999-03-17 05:04:39 +00:00
|
|
|
#ifdef __OpenBSD__
|
|
|
|
#include <dev/ic/isp_openbsd.h>
|
|
|
|
#endif
|
1998-04-22 17:54:58 +00:00
|
|
|
#ifdef __linux__
|
1998-12-28 19:22:27 +00:00
|
|
|
#include "isp_linux.h"
|
1998-04-22 17:54:58 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* General defines
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define MBOX_DELAY_COUNT 1000000 / 100
|
|
|
|
|
|
|
|
/*
|
1998-09-15 08:42:56 +00:00
|
|
|
* Local static data
|
1998-04-22 17:54:58 +00:00
|
|
|
*/
|
1998-09-15 08:42:56 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Local function prototypes.
|
|
|
|
*/
|
1998-12-05 01:33:57 +00:00
|
|
|
static int isp_parse_async __P((struct ispsoftc *, int));
|
1998-09-15 08:42:56 +00:00
|
|
|
static int isp_handle_other_response
|
1999-11-21 03:18:22 +00:00
|
|
|
__P((struct ispsoftc *, ispstatusreq_t *, u_int16_t *));
|
1998-04-22 17:54:58 +00:00
|
|
|
static void isp_parse_status
|
|
|
|
__P((struct ispsoftc *, ispstatusreq_t *, ISP_SCSI_XFER_T *));
|
1999-10-17 18:58:22 +00:00
|
|
|
static void isp_fastpost_complete __P((struct ispsoftc *, u_int32_t));
|
1999-05-11 05:06:55 +00:00
|
|
|
static void isp_scsi_init __P((struct ispsoftc *));
|
|
|
|
static void isp_scsi_channel_init __P((struct ispsoftc *, int));
|
1998-04-22 17:54:58 +00:00
|
|
|
static void isp_fibre_init __P((struct ispsoftc *));
|
1999-03-17 05:04:39 +00:00
|
|
|
static void isp_mark_getpdb_all __P((struct ispsoftc *));
|
|
|
|
static int isp_getpdb __P((struct ispsoftc *, int, isp_pdb_t *));
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
static u_int64_t isp_get_portname __P((struct ispsoftc *, int, int));
|
1999-03-25 22:52:45 +00:00
|
|
|
static int isp_fclink_test __P((struct ispsoftc *, int));
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
static int isp_same_lportdb __P((struct lportdb *, struct lportdb *));
|
|
|
|
static int isp_pdb_sync __P((struct ispsoftc *, int));
|
|
|
|
#ifdef ISP2100_FABRIC
|
|
|
|
static int isp_scan_fabric __P((struct ispsoftc *));
|
|
|
|
#endif
|
1998-04-22 17:54:58 +00:00
|
|
|
static void isp_fw_state __P((struct ispsoftc *));
|
|
|
|
static void isp_dumpregs __P((struct ispsoftc *, const char *));
|
|
|
|
static void isp_mboxcmd __P((struct ispsoftc *, mbreg_t *));
|
|
|
|
|
1999-05-11 05:06:55 +00:00
|
|
|
static void isp_update __P((struct ispsoftc *));
|
|
|
|
static void isp_update_bus __P((struct ispsoftc *, int));
|
|
|
|
static void isp_setdfltparm __P((struct ispsoftc *, int));
|
1998-09-15 08:42:56 +00:00
|
|
|
static int isp_read_nvram __P((struct ispsoftc *));
|
|
|
|
static void isp_rdnvram_word __P((struct ispsoftc *, int, u_int16_t *));
|
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
/*
|
|
|
|
* Reset Hardware.
|
1998-09-15 08:42:56 +00:00
|
|
|
*
|
1999-10-30 19:32:44 +00:00
|
|
|
* Hit the chip over the head, download new f/w if available and set it running.
|
1998-09-15 08:42:56 +00:00
|
|
|
*
|
|
|
|
* Locking done elsewhere.
|
1998-04-22 17:54:58 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
isp_reset(isp)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
{
|
|
|
|
mbreg_t mbs;
|
1999-01-30 07:29:00 +00:00
|
|
|
int loops, i, dodnld = 1;
|
1998-04-22 17:54:58 +00:00
|
|
|
char *revname;
|
|
|
|
|
|
|
|
isp->isp_state = ISP_NILSTATE;
|
|
|
|
|
|
|
|
/*
|
1998-09-15 08:42:56 +00:00
|
|
|
* Basic types (SCSI, FibreChannel and PCI or SBus)
|
|
|
|
* have been set in the MD code. We figure out more
|
|
|
|
* here.
|
1998-04-22 17:54:58 +00:00
|
|
|
*/
|
|
|
|
isp->isp_dblev = DFLT_DBLEVEL;
|
1999-01-30 07:29:00 +00:00
|
|
|
|
1999-02-09 01:07:06 +00:00
|
|
|
/*
|
|
|
|
* After we've fired this chip up, zero out the conf1 register
|
|
|
|
* for SCSI adapters and other settings for the 2100.
|
|
|
|
*/
|
|
|
|
|
1999-01-30 07:29:00 +00:00
|
|
|
/*
|
|
|
|
* Get the current running firmware revision out of the
|
|
|
|
* chip before we hit it over the head (if this is our
|
|
|
|
* first time through). Note that we store this as the
|
|
|
|
* 'ROM' firmware revision- which it may not be. In any
|
|
|
|
* case, we don't really use this yet, but we may in
|
|
|
|
* the future.
|
|
|
|
*/
|
1999-11-21 03:18:22 +00:00
|
|
|
if (isp->isp_touched == 0) {
|
1999-01-30 07:29:00 +00:00
|
|
|
/*
|
|
|
|
* Just in case it was paused...
|
|
|
|
*/
|
1999-01-10 02:55:10 +00:00
|
|
|
ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE);
|
1999-01-30 07:29:00 +00:00
|
|
|
mbs.param[0] = MBOX_ABOUT_FIRMWARE;
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
1999-04-04 02:28:29 +00:00
|
|
|
/*
|
|
|
|
* If this fails, it probably means we're running
|
|
|
|
* an old prom, if anything at all...
|
|
|
|
*/
|
|
|
|
if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
|
|
|
|
isp->isp_romfw_rev[0] = mbs.param[1];
|
|
|
|
isp->isp_romfw_rev[1] = mbs.param[2];
|
|
|
|
isp->isp_romfw_rev[2] = mbs.param[3];
|
1999-01-10 02:55:10 +00:00
|
|
|
}
|
1999-11-21 03:18:22 +00:00
|
|
|
isp->isp_touched = 1;
|
1999-01-10 02:55:10 +00:00
|
|
|
}
|
|
|
|
|
1999-04-04 02:28:29 +00:00
|
|
|
DISABLE_INTS(isp);
|
|
|
|
|
1999-01-30 07:29:00 +00:00
|
|
|
/*
|
1999-12-16 05:42:02 +00:00
|
|
|
* Put the board into PAUSE mode (so we can read the SXP registers).
|
1999-01-30 07:29:00 +00:00
|
|
|
*/
|
|
|
|
ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE);
|
|
|
|
|
1999-03-17 05:04:39 +00:00
|
|
|
if (IS_FC(isp)) {
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
revname = "2X00";
|
|
|
|
switch (isp->isp_type) {
|
|
|
|
case ISP_HA_FC_2100:
|
|
|
|
revname[1] = '1';
|
|
|
|
break;
|
|
|
|
case ISP_HA_FC_2200:
|
|
|
|
revname[1] = '2';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
1999-12-16 05:42:02 +00:00
|
|
|
} else if (IS_1240(isp)) {
|
|
|
|
sdparam *sdp = isp->isp_param;
|
|
|
|
revname = "1240";
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_clock = 60;
|
1999-12-16 05:42:02 +00:00
|
|
|
sdp->isp_ultramode = 1;
|
|
|
|
sdp++;
|
|
|
|
sdp->isp_ultramode = 1;
|
|
|
|
/*
|
|
|
|
* XXX: Should probably do some bus sensing.
|
|
|
|
*/
|
|
|
|
} else if (IS_ULTRA2(isp)) {
|
|
|
|
static char *m = "%s: bus %d is in %s Mode\n";
|
1999-03-25 22:52:45 +00:00
|
|
|
u_int16_t l;
|
1999-03-17 05:04:39 +00:00
|
|
|
sdparam *sdp = isp->isp_param;
|
1999-12-16 05:42:02 +00:00
|
|
|
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_clock = 100;
|
1999-12-16 05:42:02 +00:00
|
|
|
|
|
|
|
revname = "1080";
|
1999-03-25 22:52:45 +00:00
|
|
|
l = ISP_READ(isp, SXP_PINS_DIFF) & ISP1080_MODE_MASK;
|
|
|
|
switch (l) {
|
|
|
|
case ISP1080_LVD_MODE:
|
|
|
|
sdp->isp_lvdmode = 1;
|
1999-12-16 05:42:02 +00:00
|
|
|
CFGPRINTF(m, isp->isp_name, 0, "LVD");
|
1999-03-25 22:52:45 +00:00
|
|
|
break;
|
|
|
|
case ISP1080_HVD_MODE:
|
|
|
|
sdp->isp_diffmode = 1;
|
1999-12-16 05:42:02 +00:00
|
|
|
CFGPRINTF(m, isp->isp_name, 0, "Differential");
|
1999-03-25 22:52:45 +00:00
|
|
|
break;
|
|
|
|
case ISP1080_SE_MODE:
|
|
|
|
sdp->isp_ultramode = 1;
|
1999-12-16 05:42:02 +00:00
|
|
|
CFGPRINTF(m, isp->isp_name, 0, "Single-Ended");
|
1999-03-25 22:52:45 +00:00
|
|
|
break;
|
|
|
|
default:
|
1999-12-16 05:42:02 +00:00
|
|
|
CFGPRINTF("%s: unknown mode on bus %d (0x%x)\n",
|
|
|
|
isp->isp_name, 0, l);
|
1999-03-25 22:52:45 +00:00
|
|
|
break;
|
|
|
|
}
|
1999-12-16 05:42:02 +00:00
|
|
|
|
|
|
|
if (IS_1280(isp)) {
|
|
|
|
sdp++;
|
|
|
|
revname[1] = '2';
|
|
|
|
l = ISP_READ(isp, SXP_PINS_DIFF|SXP_BANK1_SELECT);
|
|
|
|
l &= ISP1080_MODE_MASK;
|
|
|
|
switch(l) {
|
|
|
|
case ISP1080_LVD_MODE:
|
|
|
|
sdp->isp_lvdmode = 1;
|
|
|
|
CFGPRINTF(m, isp->isp_name, 1, "LVD");
|
|
|
|
break;
|
|
|
|
case ISP1080_HVD_MODE:
|
|
|
|
sdp->isp_diffmode = 1;
|
|
|
|
CFGPRINTF(m, isp->isp_name, 1, "Differential");
|
|
|
|
break;
|
|
|
|
case ISP1080_SE_MODE:
|
|
|
|
sdp->isp_ultramode = 1;
|
|
|
|
CFGPRINTF(m, isp->isp_name, 1, "Single-Ended");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
CFGPRINTF("%s: unknown mode on bus %d (0x%x)\n",
|
|
|
|
isp->isp_name, 1, l);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1998-04-22 17:54:58 +00:00
|
|
|
} else {
|
1998-09-15 08:42:56 +00:00
|
|
|
sdparam *sdp = isp->isp_param;
|
1999-01-10 02:55:10 +00:00
|
|
|
i = ISP_READ(isp, BIU_CONF0) & BIU_CONF0_HW_MASK;
|
|
|
|
switch (i) {
|
1998-04-22 17:54:58 +00:00
|
|
|
default:
|
1998-09-15 08:42:56 +00:00
|
|
|
PRINTF("%s: unknown chip rev. 0x%x- assuming a 1020\n",
|
1999-01-10 02:55:10 +00:00
|
|
|
isp->isp_name, i);
|
1998-09-15 08:42:56 +00:00
|
|
|
/* FALLTHROUGH */
|
|
|
|
case 1:
|
1999-03-25 22:52:45 +00:00
|
|
|
revname = "1020";
|
1998-04-22 17:54:58 +00:00
|
|
|
isp->isp_type = ISP_HA_SCSI_1020;
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_clock = 40;
|
1998-04-22 17:54:58 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
1998-09-15 08:42:56 +00:00
|
|
|
/*
|
|
|
|
* Some 1020A chips are Ultra Capable, but don't
|
|
|
|
* run the clock rate up for that unless told to
|
|
|
|
* do so by the Ultra Capable bits being set.
|
|
|
|
*/
|
1999-03-25 22:52:45 +00:00
|
|
|
revname = "1020A";
|
1998-09-15 08:42:56 +00:00
|
|
|
isp->isp_type = ISP_HA_SCSI_1020A;
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_clock = 40;
|
1998-04-22 17:54:58 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
1998-09-15 08:42:56 +00:00
|
|
|
revname = "1040";
|
|
|
|
isp->isp_type = ISP_HA_SCSI_1040;
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_clock = 60;
|
1998-09-15 08:42:56 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
1998-04-22 17:54:58 +00:00
|
|
|
revname = "1040A";
|
|
|
|
isp->isp_type = ISP_HA_SCSI_1040A;
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_clock = 60;
|
1998-04-22 17:54:58 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
revname = "1040B";
|
|
|
|
isp->isp_type = ISP_HA_SCSI_1040B;
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_clock = 60;
|
1998-04-22 17:54:58 +00:00
|
|
|
break;
|
1999-04-04 02:28:29 +00:00
|
|
|
case 6:
|
1999-12-16 05:42:02 +00:00
|
|
|
revname = "1040C";
|
1999-04-04 02:28:29 +00:00
|
|
|
isp->isp_type = ISP_HA_SCSI_1040C;
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_clock = 60;
|
1999-04-04 02:28:29 +00:00
|
|
|
break;
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
1998-09-15 08:42:56 +00:00
|
|
|
/*
|
1999-01-30 07:29:00 +00:00
|
|
|
* Now, while we're at it, gather info about ultra
|
|
|
|
* and/or differential mode.
|
1998-09-15 08:42:56 +00:00
|
|
|
*/
|
1999-01-30 07:29:00 +00:00
|
|
|
if (ISP_READ(isp, SXP_PINS_DIFF) & SXP_PINS_DIFF_MODE) {
|
1999-12-03 06:55:39 +00:00
|
|
|
CFGPRINTF("%s: Differential Mode\n", isp->isp_name);
|
1999-01-30 07:29:00 +00:00
|
|
|
sdp->isp_diffmode = 1;
|
1999-01-10 02:55:10 +00:00
|
|
|
} else {
|
1999-01-30 07:29:00 +00:00
|
|
|
sdp->isp_diffmode = 0;
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
1999-01-30 07:29:00 +00:00
|
|
|
i = ISP_READ(isp, RISC_PSR);
|
|
|
|
if (isp->isp_bustype == ISP_BT_SBUS) {
|
|
|
|
i &= RISC_PSR_SBUS_ULTRA;
|
|
|
|
} else {
|
|
|
|
i &= RISC_PSR_PCI_ULTRA;
|
|
|
|
}
|
|
|
|
if (i != 0) {
|
1999-12-03 06:55:39 +00:00
|
|
|
CFGPRINTF("%s: Ultra Mode Capable\n", isp->isp_name);
|
1999-01-30 07:29:00 +00:00
|
|
|
sdp->isp_ultramode = 1;
|
1999-03-17 05:04:39 +00:00
|
|
|
/*
|
|
|
|
* If we're in Ultra Mode, we have to be 60Mhz clock-
|
|
|
|
* even for the SBus version.
|
|
|
|
*/
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_clock = 60;
|
1999-03-25 22:52:45 +00:00
|
|
|
} else {
|
1999-01-30 07:29:00 +00:00
|
|
|
sdp->isp_ultramode = 0;
|
1999-03-17 05:04:39 +00:00
|
|
|
/*
|
|
|
|
* Clock is known. Gronk.
|
|
|
|
*/
|
1999-01-30 07:29:00 +00:00
|
|
|
}
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
/*
|
|
|
|
* Machine dependent clock (if set) overrides
|
|
|
|
* our generic determinations.
|
|
|
|
*/
|
|
|
|
if (isp->isp_mdvec->dv_clock) {
|
1999-05-11 05:06:55 +00:00
|
|
|
if (isp->isp_mdvec->dv_clock < isp->isp_clock) {
|
|
|
|
isp->isp_clock = isp->isp_mdvec->dv_clock;
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
|
|
|
}
|
1999-01-30 07:29:00 +00:00
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Do MD specific pre initialization
|
|
|
|
*/
|
|
|
|
ISP_RESET0(isp);
|
1998-09-15 08:42:56 +00:00
|
|
|
|
1999-01-30 07:29:00 +00:00
|
|
|
again:
|
1999-01-10 02:55:10 +00:00
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
/*
|
|
|
|
* Hit the chip over the head with hammer,
|
|
|
|
* and give the ISP a chance to recover.
|
|
|
|
*/
|
|
|
|
|
1999-03-17 05:04:39 +00:00
|
|
|
if (IS_SCSI(isp)) {
|
1998-04-22 17:54:58 +00:00
|
|
|
ISP_WRITE(isp, BIU_ICR, BIU_ICR_SOFT_RESET);
|
|
|
|
/*
|
|
|
|
* A slight delay...
|
|
|
|
*/
|
|
|
|
SYS_DELAY(100);
|
|
|
|
|
1999-03-17 05:04:39 +00:00
|
|
|
#if 0
|
|
|
|
PRINTF("%s: mbox0-5: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
|
|
|
|
isp->isp_name, ISP_READ(isp, OUTMAILBOX0),
|
|
|
|
ISP_READ(isp, OUTMAILBOX1), ISP_READ(isp, OUTMAILBOX2),
|
|
|
|
ISP_READ(isp, OUTMAILBOX3), ISP_READ(isp, OUTMAILBOX4),
|
|
|
|
ISP_READ(isp, OUTMAILBOX5));
|
|
|
|
#endif
|
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
/*
|
|
|
|
* Clear data && control DMA engines.
|
|
|
|
*/
|
|
|
|
ISP_WRITE(isp, CDMA_CONTROL,
|
1999-03-25 22:52:45 +00:00
|
|
|
DMA_CNTRL_CLEAR_CHAN | DMA_CNTRL_RESET_INT);
|
1998-04-22 17:54:58 +00:00
|
|
|
ISP_WRITE(isp, DDMA_CONTROL,
|
1999-03-25 22:52:45 +00:00
|
|
|
DMA_CNTRL_CLEAR_CHAN | DMA_CNTRL_RESET_INT);
|
1999-03-17 05:04:39 +00:00
|
|
|
|
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
} else {
|
|
|
|
ISP_WRITE(isp, BIU2100_CSR, BIU2100_SOFT_RESET);
|
|
|
|
/*
|
|
|
|
* A slight delay...
|
|
|
|
*/
|
|
|
|
SYS_DELAY(100);
|
1999-01-30 07:29:00 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Clear data && control DMA engines.
|
|
|
|
*/
|
1998-04-22 17:54:58 +00:00
|
|
|
ISP_WRITE(isp, CDMA2100_CONTROL,
|
|
|
|
DMA_CNTRL2100_CLEAR_CHAN | DMA_CNTRL2100_RESET_INT);
|
|
|
|
ISP_WRITE(isp, TDMA2100_CONTROL,
|
|
|
|
DMA_CNTRL2100_CLEAR_CHAN | DMA_CNTRL2100_RESET_INT);
|
|
|
|
ISP_WRITE(isp, RDMA2100_CONTROL,
|
|
|
|
DMA_CNTRL2100_CLEAR_CHAN | DMA_CNTRL2100_RESET_INT);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Wait for ISP to be ready to go...
|
|
|
|
*/
|
|
|
|
loops = MBOX_DELAY_COUNT;
|
|
|
|
for (;;) {
|
1999-08-16 19:59:55 +00:00
|
|
|
if (IS_SCSI(isp)) {
|
1998-04-22 17:54:58 +00:00
|
|
|
if (!(ISP_READ(isp, BIU_ICR) & BIU_ICR_SOFT_RESET))
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
if (!(ISP_READ(isp, BIU2100_CSR) & BIU2100_SOFT_RESET))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
SYS_DELAY(100);
|
|
|
|
if (--loops < 0) {
|
|
|
|
isp_dumpregs(isp, "chip reset timed out");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
1999-01-30 07:29:00 +00:00
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
/*
|
1999-01-30 07:29:00 +00:00
|
|
|
* After we've fired this chip up, zero out the conf1 register
|
|
|
|
* for SCSI adapters and other settings for the 2100.
|
1998-04-22 17:54:58 +00:00
|
|
|
*/
|
1999-01-30 07:29:00 +00:00
|
|
|
|
1999-03-17 05:04:39 +00:00
|
|
|
if (IS_SCSI(isp)) {
|
1998-04-22 17:54:58 +00:00
|
|
|
ISP_WRITE(isp, BIU_CONF1, 0);
|
|
|
|
} else {
|
|
|
|
ISP_WRITE(isp, BIU2100_CSR, 0);
|
|
|
|
}
|
|
|
|
|
1999-01-30 07:29:00 +00:00
|
|
|
/*
|
|
|
|
* Reset RISC Processor
|
|
|
|
*/
|
1998-04-22 17:54:58 +00:00
|
|
|
ISP_WRITE(isp, HCCR, HCCR_CMD_RESET);
|
|
|
|
SYS_DELAY(100);
|
|
|
|
|
1999-01-10 02:55:10 +00:00
|
|
|
/*
|
1999-01-30 07:29:00 +00:00
|
|
|
* Establish some initial burst rate stuff.
|
1999-01-10 02:55:10 +00:00
|
|
|
* (only for the 1XX0 boards). This really should
|
|
|
|
* be done later after fetching from NVRAM.
|
|
|
|
*/
|
1999-03-17 05:04:39 +00:00
|
|
|
if (IS_SCSI(isp)) {
|
1999-01-30 07:29:00 +00:00
|
|
|
u_int16_t tmp = isp->isp_mdvec->dv_conf1;
|
1999-01-10 02:55:10 +00:00
|
|
|
/*
|
|
|
|
* Busted FIFO. Turn off all but burst enables.
|
|
|
|
*/
|
|
|
|
if (isp->isp_type == ISP_HA_SCSI_1040A) {
|
1999-01-30 07:29:00 +00:00
|
|
|
tmp &= BIU_BURST_ENABLE;
|
1999-01-10 02:55:10 +00:00
|
|
|
}
|
1999-01-30 07:29:00 +00:00
|
|
|
ISP_SETBITS(isp, BIU_CONF1, tmp);
|
|
|
|
if (tmp & BIU_BURST_ENABLE) {
|
1998-04-22 17:54:58 +00:00
|
|
|
ISP_SETBITS(isp, CDMA_CONF, DMA_ENABLE_BURST);
|
|
|
|
ISP_SETBITS(isp, DDMA_CONF, DMA_ENABLE_BURST);
|
|
|
|
}
|
1999-01-30 07:29:00 +00:00
|
|
|
#ifdef PTI_CARDS
|
|
|
|
if (((sdparam *) isp->isp_param)->isp_ultramode) {
|
1999-03-25 22:52:45 +00:00
|
|
|
while (ISP_READ(isp, RISC_MTR) != 0x1313) {
|
1999-01-30 07:29:00 +00:00
|
|
|
ISP_WRITE(isp, RISC_MTR, 0x1313);
|
|
|
|
ISP_WRITE(isp, HCCR, HCCR_CMD_STEP);
|
|
|
|
}
|
1999-03-25 22:52:45 +00:00
|
|
|
} else {
|
1999-01-30 07:29:00 +00:00
|
|
|
ISP_WRITE(isp, RISC_MTR, 0x1212);
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* PTI specific register
|
|
|
|
*/
|
|
|
|
ISP_WRITE(isp, RISC_EMB, DUAL_BANK)
|
|
|
|
#else
|
|
|
|
ISP_WRITE(isp, RISC_MTR, 0x1212);
|
|
|
|
#endif
|
|
|
|
} else {
|
|
|
|
ISP_WRITE(isp, RISC_MTR2100, 0x1212);
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
1999-01-30 07:29:00 +00:00
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE); /* release paused processor */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Do MD specific post initialization
|
|
|
|
*/
|
|
|
|
ISP_RESET1(isp);
|
|
|
|
|
1999-01-30 07:29:00 +00:00
|
|
|
/*
|
|
|
|
* Wait for everything to finish firing up...
|
|
|
|
*/
|
|
|
|
loops = MBOX_DELAY_COUNT;
|
|
|
|
while (ISP_READ(isp, OUTMAILBOX0) == MBOX_BUSY) {
|
|
|
|
SYS_DELAY(100);
|
|
|
|
if (--loops < 0) {
|
|
|
|
PRINTF("%s: MBOX_BUSY never cleared on reset\n",
|
|
|
|
isp->isp_name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Up until this point we've done everything by just reading or
|
|
|
|
* setting registers. From this point on we rely on at least *some*
|
|
|
|
* kind of firmware running in the card.
|
|
|
|
*/
|
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
/*
|
|
|
|
* Do some sanity checking.
|
|
|
|
*/
|
|
|
|
mbs.param[0] = MBOX_NO_OP;
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
|
|
|
isp_dumpregs(isp, "NOP test failed");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
if (IS_SCSI(isp)) {
|
1998-04-22 17:54:58 +00:00
|
|
|
mbs.param[0] = MBOX_MAILBOX_REG_TEST;
|
|
|
|
mbs.param[1] = 0xdead;
|
|
|
|
mbs.param[2] = 0xbeef;
|
|
|
|
mbs.param[3] = 0xffff;
|
|
|
|
mbs.param[4] = 0x1111;
|
|
|
|
mbs.param[5] = 0xa5a5;
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
|
|
|
isp_dumpregs(isp,
|
|
|
|
"Mailbox Register test didn't complete");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (mbs.param[1] != 0xdead || mbs.param[2] != 0xbeef ||
|
|
|
|
mbs.param[3] != 0xffff || mbs.param[4] != 0x1111 ||
|
|
|
|
mbs.param[5] != 0xa5a5) {
|
|
|
|
isp_dumpregs(isp, "Register Test Failed");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Download new Firmware, unless requested not to do so.
|
|
|
|
* This is made slightly trickier in some cases where the
|
|
|
|
* firmware of the ROM revision is newer than the revision
|
|
|
|
* compiled into the driver. So, where we used to compare
|
|
|
|
* versions of our f/w and the ROM f/w, now we just see
|
|
|
|
* whether we have f/w at all and whether a config flag
|
|
|
|
* has disabled our download.
|
|
|
|
*/
|
1999-11-01 04:39:52 +00:00
|
|
|
if ((isp->isp_mdvec->dv_ispfw == NULL) ||
|
1998-04-22 17:54:58 +00:00
|
|
|
(isp->isp_confopts & ISP_CFG_NORELOAD)) {
|
|
|
|
dodnld = 0;
|
|
|
|
}
|
|
|
|
|
1999-11-01 04:39:52 +00:00
|
|
|
if (dodnld) {
|
1999-10-30 19:32:44 +00:00
|
|
|
u_int16_t fwlen = isp->isp_mdvec->dv_fwlen;
|
|
|
|
if (fwlen == 0)
|
|
|
|
fwlen = isp->isp_mdvec->dv_ispfw[3]; /* usually here */
|
|
|
|
for (i = 0; i < fwlen; i++) {
|
1998-04-22 17:54:58 +00:00
|
|
|
mbs.param[0] = MBOX_WRITE_RAM_WORD;
|
|
|
|
mbs.param[1] = isp->isp_mdvec->dv_codeorg + i;
|
|
|
|
mbs.param[2] = isp->isp_mdvec->dv_ispfw[i];
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
1999-01-30 07:29:00 +00:00
|
|
|
PRINTF("%s: F/W download failed at word %d\n",
|
|
|
|
isp->isp_name, i);
|
|
|
|
dodnld = 0;
|
|
|
|
goto again;
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-01-30 07:29:00 +00:00
|
|
|
/*
|
|
|
|
* Verify that it downloaded correctly.
|
|
|
|
*/
|
|
|
|
mbs.param[0] = MBOX_VERIFY_CHECKSUM;
|
|
|
|
mbs.param[1] = isp->isp_mdvec->dv_codeorg;
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
|
|
|
isp_dumpregs(isp, "ram checksum failure");
|
|
|
|
return;
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
IDPRINTF(3, ("%s: skipping f/w download\n", isp->isp_name));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Now start it rolling.
|
|
|
|
*
|
|
|
|
* If we didn't actually download f/w,
|
|
|
|
* we still need to (re)start it.
|
|
|
|
*/
|
|
|
|
|
|
|
|
mbs.param[0] = MBOX_EXEC_FIRMWARE;
|
1999-01-30 07:29:00 +00:00
|
|
|
if (isp->isp_mdvec->dv_codeorg)
|
|
|
|
mbs.param[1] = isp->isp_mdvec->dv_codeorg;
|
|
|
|
else
|
|
|
|
mbs.param[1] = 0x1000;
|
1998-04-22 17:54:58 +00:00
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
|
1999-08-16 19:59:55 +00:00
|
|
|
if (IS_SCSI(isp)) {
|
1998-04-22 17:54:58 +00:00
|
|
|
/*
|
1998-09-15 08:42:56 +00:00
|
|
|
* Set CLOCK RATE, but only if asked to.
|
1998-04-22 17:54:58 +00:00
|
|
|
*/
|
1999-05-11 05:06:55 +00:00
|
|
|
if (isp->isp_clock) {
|
1998-04-22 17:54:58 +00:00
|
|
|
mbs.param[0] = MBOX_SET_CLOCK_RATE;
|
1999-05-11 05:06:55 +00:00
|
|
|
mbs.param[1] = isp->isp_clock;
|
1998-04-22 17:54:58 +00:00
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
1999-10-17 18:58:22 +00:00
|
|
|
PRINTF("failed to set clockrate (0x%x)\n",
|
|
|
|
mbs.param[0]);
|
1998-09-15 08:42:56 +00:00
|
|
|
/* but continue */
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mbs.param[0] = MBOX_ABOUT_FIRMWARE;
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
1999-10-17 18:58:22 +00:00
|
|
|
PRINTF("could not get f/w started (0x%x)\n", mbs.param[0]);
|
1998-04-22 17:54:58 +00:00
|
|
|
return;
|
|
|
|
}
|
1999-10-17 18:58:22 +00:00
|
|
|
CFGPRINTF("%s: Board Revision %s, %s F/W Revision %d.%d.%d\n",
|
|
|
|
isp->isp_name, revname, dodnld? "loaded" : "resident",
|
|
|
|
mbs.param[1], mbs.param[2], mbs.param[3]);
|
1999-03-25 22:52:45 +00:00
|
|
|
if (IS_FC(isp)) {
|
1999-02-09 01:07:06 +00:00
|
|
|
if (ISP_READ(isp, BIU2100_CSR) & BIU2100_PCI64) {
|
1999-10-17 18:58:22 +00:00
|
|
|
CFGPRINTF("%s: in 64-Bit PCI slot\n", isp->isp_name);
|
1999-02-09 01:07:06 +00:00
|
|
|
}
|
|
|
|
}
|
1999-10-17 18:58:22 +00:00
|
|
|
|
1999-04-04 02:28:29 +00:00
|
|
|
isp->isp_fwrev[0] = mbs.param[1];
|
|
|
|
isp->isp_fwrev[1] = mbs.param[2];
|
|
|
|
isp->isp_fwrev[2] = mbs.param[3];
|
|
|
|
if (isp->isp_romfw_rev[0] || isp->isp_romfw_rev[1] ||
|
|
|
|
isp->isp_romfw_rev[2]) {
|
1999-10-17 18:58:22 +00:00
|
|
|
CFGPRINTF("%s: Last F/W revision was %d.%d.%d\n", isp->isp_name,
|
1999-04-04 02:28:29 +00:00
|
|
|
isp->isp_romfw_rev[0], isp->isp_romfw_rev[1],
|
|
|
|
isp->isp_romfw_rev[2]);
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
1999-10-17 18:58:22 +00:00
|
|
|
|
|
|
|
mbs.param[0] = MBOX_GET_FIRMWARE_STATUS;
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
|
|
|
PRINTF("%s: could not GET FIRMWARE STATUS\n", isp->isp_name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
isp->isp_maxcmds = mbs.param[2];
|
|
|
|
CFGPRINTF("%s: %d max I/O commands supported\n",
|
|
|
|
isp->isp_name, mbs.param[2]);
|
1998-04-22 17:54:58 +00:00
|
|
|
isp_fw_state(isp);
|
1999-10-17 18:58:22 +00:00
|
|
|
|
1999-05-11 05:06:55 +00:00
|
|
|
/*
|
|
|
|
* Set up DMA for the request and result mailboxes.
|
|
|
|
*/
|
|
|
|
if (ISP_MBOXDMASETUP(isp) != 0) {
|
|
|
|
PRINTF("%s: can't setup dma mailboxes\n", isp->isp_name);
|
|
|
|
return;
|
|
|
|
}
|
1998-04-22 17:54:58 +00:00
|
|
|
isp->isp_state = ISP_RESETSTATE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1999-01-30 07:29:00 +00:00
|
|
|
* Initialize Parameters of Hardware to a known state.
|
1998-09-15 08:42:56 +00:00
|
|
|
*
|
|
|
|
* Locks are held before coming here.
|
1998-04-22 17:54:58 +00:00
|
|
|
*/
|
1998-09-15 08:42:56 +00:00
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
void
|
|
|
|
isp_init(isp)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
{
|
1998-09-15 08:42:56 +00:00
|
|
|
/*
|
1999-05-11 05:06:55 +00:00
|
|
|
* Must do this first to get defaults established.
|
1998-09-15 08:42:56 +00:00
|
|
|
*/
|
1999-05-11 05:06:55 +00:00
|
|
|
isp_setdfltparm(isp, 0);
|
1999-12-16 05:42:02 +00:00
|
|
|
if (IS_DUALBUS(isp)) {
|
1999-05-11 05:06:55 +00:00
|
|
|
isp_setdfltparm(isp, 1);
|
1999-03-17 05:04:39 +00:00
|
|
|
}
|
1999-03-25 22:52:45 +00:00
|
|
|
|
1999-03-17 05:04:39 +00:00
|
|
|
if (IS_FC(isp)) {
|
1998-04-22 17:54:58 +00:00
|
|
|
isp_fibre_init(isp);
|
1999-05-11 05:06:55 +00:00
|
|
|
} else {
|
|
|
|
isp_scsi_init(isp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
isp_scsi_init(isp)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
{
|
|
|
|
sdparam *sdp_chan0, *sdp_chan1;
|
|
|
|
mbreg_t mbs;
|
|
|
|
|
|
|
|
sdp_chan0 = isp->isp_param;
|
|
|
|
sdp_chan1 = sdp_chan0;
|
1999-12-16 05:42:02 +00:00
|
|
|
if (IS_DUALBUS(isp)) {
|
1999-05-11 05:06:55 +00:00
|
|
|
sdp_chan1++;
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
1999-05-11 05:06:55 +00:00
|
|
|
|
|
|
|
/* First do overall per-card settings. */
|
1998-04-22 17:54:58 +00:00
|
|
|
|
1999-02-09 01:07:06 +00:00
|
|
|
/*
|
|
|
|
* If we have fast memory timing enabled, turn it on.
|
|
|
|
*/
|
1999-05-11 05:06:55 +00:00
|
|
|
if (isp->isp_fast_mttr) {
|
1999-02-09 01:07:06 +00:00
|
|
|
ISP_WRITE(isp, RISC_MTR, 0x1313);
|
|
|
|
}
|
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
/*
|
1999-05-11 05:06:55 +00:00
|
|
|
* Set Retry Delay and Count.
|
|
|
|
* You set both channels at the same time.
|
1998-04-22 17:54:58 +00:00
|
|
|
*/
|
1999-05-11 05:06:55 +00:00
|
|
|
mbs.param[0] = MBOX_SET_RETRY_COUNT;
|
|
|
|
mbs.param[1] = sdp_chan0->isp_retry_count;
|
|
|
|
mbs.param[2] = sdp_chan0->isp_retry_delay;
|
|
|
|
mbs.param[6] = sdp_chan1->isp_retry_count;
|
|
|
|
mbs.param[7] = sdp_chan1->isp_retry_delay;
|
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
1999-05-11 05:06:55 +00:00
|
|
|
PRINTF("%s: failed to set retry count and retry delay\n",
|
|
|
|
isp->isp_name);
|
1998-04-22 17:54:58 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
/*
|
1999-05-11 05:06:55 +00:00
|
|
|
* Set ASYNC DATA SETUP time. This is very important.
|
1998-09-15 08:42:56 +00:00
|
|
|
*/
|
1999-05-11 05:06:55 +00:00
|
|
|
mbs.param[0] = MBOX_SET_ASYNC_DATA_SETUP_TIME;
|
|
|
|
mbs.param[1] = sdp_chan0->isp_async_data_setup;
|
|
|
|
mbs.param[2] = sdp_chan1->isp_async_data_setup;
|
1998-04-22 17:54:58 +00:00
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
1999-05-11 05:06:55 +00:00
|
|
|
PRINTF("%s: failed to set asynchronous data setup time\n",
|
|
|
|
isp->isp_name);
|
1998-04-22 17:54:58 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
/*
|
1999-05-11 05:06:55 +00:00
|
|
|
* Set ACTIVE Negation State.
|
1998-09-15 08:42:56 +00:00
|
|
|
*/
|
1999-05-11 05:06:55 +00:00
|
|
|
mbs.param[0] = MBOX_SET_ACT_NEG_STATE;
|
|
|
|
mbs.param[1] =
|
|
|
|
(sdp_chan0->isp_req_ack_active_neg << 4) |
|
|
|
|
(sdp_chan0->isp_data_line_active_neg << 5);
|
|
|
|
mbs.param[2] =
|
|
|
|
(sdp_chan1->isp_req_ack_active_neg << 4) |
|
|
|
|
(sdp_chan1->isp_data_line_active_neg << 5);
|
|
|
|
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
|
|
|
PRINTF("%s: failed to set active negation state "
|
|
|
|
"(%d,%d),(%d,%d)\n", isp->isp_name,
|
|
|
|
sdp_chan0->isp_req_ack_active_neg,
|
|
|
|
sdp_chan0->isp_data_line_active_neg,
|
|
|
|
sdp_chan1->isp_req_ack_active_neg,
|
|
|
|
sdp_chan1->isp_data_line_active_neg);
|
|
|
|
/*
|
|
|
|
* But don't return.
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set the Tag Aging limit
|
|
|
|
*/
|
|
|
|
mbs.param[0] = MBOX_SET_TAG_AGE_LIMIT;
|
|
|
|
mbs.param[1] = sdp_chan0->isp_tag_aging;
|
|
|
|
mbs.param[2] = sdp_chan1->isp_tag_aging;
|
1998-04-22 17:54:58 +00:00
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
1999-05-11 05:06:55 +00:00
|
|
|
PRINTF("%s: failed to set tag age limit (%d,%d)\n",
|
|
|
|
isp->isp_name, sdp_chan0->isp_tag_aging,
|
|
|
|
sdp_chan1->isp_tag_aging);
|
1998-04-22 17:54:58 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
/*
|
1999-05-11 05:06:55 +00:00
|
|
|
* Set selection timeout.
|
1998-09-15 08:42:56 +00:00
|
|
|
*/
|
1999-05-11 05:06:55 +00:00
|
|
|
mbs.param[0] = MBOX_SET_SELECT_TIMEOUT;
|
|
|
|
mbs.param[1] = sdp_chan0->isp_selection_timeout;
|
|
|
|
mbs.param[2] = sdp_chan1->isp_selection_timeout;
|
1998-04-22 17:54:58 +00:00
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
1999-05-11 05:06:55 +00:00
|
|
|
PRINTF("%s: failed to set selection timeout\n", isp->isp_name);
|
1998-04-22 17:54:58 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-05-11 05:06:55 +00:00
|
|
|
/* now do per-channel settings */
|
|
|
|
isp_scsi_channel_init(isp, 0);
|
1999-12-16 05:42:02 +00:00
|
|
|
if (IS_DUALBUS(isp))
|
1999-05-11 05:06:55 +00:00
|
|
|
isp_scsi_channel_init(isp, 1);
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
/*
|
1999-05-11 05:06:55 +00:00
|
|
|
* Now enable request/response queues
|
1998-09-15 08:42:56 +00:00
|
|
|
*/
|
|
|
|
|
1999-05-11 05:06:55 +00:00
|
|
|
mbs.param[0] = MBOX_INIT_RES_QUEUE;
|
|
|
|
mbs.param[1] = RESULT_QUEUE_LEN;
|
|
|
|
mbs.param[2] = DMA_MSW(isp->isp_result_dma);
|
|
|
|
mbs.param[3] = DMA_LSW(isp->isp_result_dma);
|
|
|
|
mbs.param[4] = 0;
|
|
|
|
mbs.param[5] = 0;
|
1998-04-22 17:54:58 +00:00
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
1999-05-11 05:06:55 +00:00
|
|
|
PRINTF("%s: set of response queue failed\n", isp->isp_name);
|
1998-04-22 17:54:58 +00:00
|
|
|
return;
|
|
|
|
}
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_residx = 0;
|
|
|
|
|
|
|
|
mbs.param[0] = MBOX_INIT_REQ_QUEUE;
|
|
|
|
mbs.param[1] = RQUEST_QUEUE_LEN;
|
|
|
|
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);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
|
|
|
PRINTF("%s: set of request queue failed\n", isp->isp_name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
isp->isp_reqidx = isp->isp_reqodx = 0;
|
1998-04-22 17:54:58 +00:00
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
/*
|
1999-12-20 01:34:01 +00:00
|
|
|
* Turn on Fast Posting, LVD transitions
|
|
|
|
*
|
|
|
|
* Ultra2 F/W always has had fast posting (and LVD transitions)
|
|
|
|
*
|
|
|
|
* Ultra and older (i.e., SBus) cards may not. Assume SBus cards
|
|
|
|
* do not, and only guess that 4.55.0 <= x < 5.0.0 (initiator
|
|
|
|
* only) and x >= 7.55 (initiator/target) has fast posting.
|
1998-09-15 08:42:56 +00:00
|
|
|
*/
|
|
|
|
|
1999-12-20 01:34:01 +00:00
|
|
|
mbs.param[0] = MBOX_SET_FW_FEATURES;
|
|
|
|
mbs.param[1] = 0;
|
|
|
|
if (IS_ULTRA2(isp))
|
|
|
|
mbs.param[1] |= FW_FEATURE_LVD_NOTIFY;
|
1999-05-11 05:06:55 +00:00
|
|
|
#ifndef ISP_NO_FASTPOST_SCSI
|
1999-12-20 01:34:01 +00:00
|
|
|
if ((ISP_FW_REVX(isp->isp_fwrev) >= ISP_FW_REV(4, 55, 0) &&
|
|
|
|
(ISP_FW_REVX(isp->isp_fwrev) < ISP_FW_REV(5, 0, 0))) ||
|
|
|
|
(ISP_FW_REVX(isp->isp_fwrev) >= ISP_FW_REV(7, 55, 0))) {
|
1999-05-11 05:06:55 +00:00
|
|
|
mbs.param[1] |= FW_FEATURE_FAST_POST;
|
1999-12-20 01:34:01 +00:00
|
|
|
}
|
1999-05-11 05:06:55 +00:00
|
|
|
#endif
|
1999-12-20 01:34:01 +00:00
|
|
|
if (mbs.param[1] != 0) {
|
|
|
|
u_int16_t sfeat = mbs.param[1];
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
|
|
|
PRINTF("%s: cannot enable FW features (0x%x)\n",
|
|
|
|
isp->isp_name, sfeat);
|
|
|
|
} else {
|
|
|
|
CFGPRINTF("%s: enabled FW features (0x%x)\n",
|
|
|
|
isp->isp_name, sfeat);
|
1999-05-11 05:06:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Let the outer layers decide whether to issue a SCSI bus reset.
|
|
|
|
*/
|
|
|
|
isp->isp_state = ISP_INITSTATE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
isp_scsi_channel_init(isp, channel)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
int channel;
|
|
|
|
{
|
|
|
|
sdparam *sdp;
|
|
|
|
mbreg_t mbs;
|
|
|
|
int tgt;
|
|
|
|
|
|
|
|
sdp = isp->isp_param;
|
|
|
|
sdp += channel;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set (possibly new) Initiator ID.
|
|
|
|
*/
|
|
|
|
mbs.param[0] = MBOX_SET_INIT_SCSI_ID;
|
|
|
|
mbs.param[1] = (channel << 7) | sdp->isp_initiator_id;
|
1998-04-22 17:54:58 +00:00
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
1999-05-11 05:06:55 +00:00
|
|
|
PRINTF("%s: cannot set initiator id on bus %d to %d\n",
|
|
|
|
isp->isp_name, channel, sdp->isp_initiator_id);
|
1998-04-22 17:54:58 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
/*
|
1999-02-09 01:07:06 +00:00
|
|
|
* Set current per-target parameters to a safe minimum.
|
1998-09-15 08:42:56 +00:00
|
|
|
*/
|
|
|
|
for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
|
|
|
|
int maxlun, lun;
|
1999-02-09 01:07:06 +00:00
|
|
|
u_int16_t sdf;
|
1998-09-15 08:42:56 +00:00
|
|
|
|
1999-05-11 05:06:55 +00:00
|
|
|
if (sdp->isp_devparam[tgt].dev_enable == 0) {
|
1999-08-16 19:59:55 +00:00
|
|
|
IDPRINTF(1, ("%s: skipping target %d bus %d settings\n",
|
|
|
|
isp->isp_name, tgt, channel));
|
1998-04-22 17:54:58 +00:00
|
|
|
continue;
|
1999-05-11 05:06:55 +00:00
|
|
|
}
|
1998-04-22 17:54:58 +00:00
|
|
|
|
1999-05-11 05:06:55 +00:00
|
|
|
/*
|
|
|
|
* If we're in LVD mode, then we pretty much should
|
|
|
|
* only disable tagged queuing.
|
|
|
|
*/
|
1999-12-16 05:42:02 +00:00
|
|
|
if (IS_ULTRA2(isp) && sdp->isp_lvdmode) {
|
1999-04-04 02:28:29 +00:00
|
|
|
sdf = DPARM_DEFAULT & ~DPARM_TQING;
|
|
|
|
} else {
|
1999-12-20 01:34:01 +00:00
|
|
|
int rvf = ISP_FW_REVX(isp->isp_fwrev);
|
1999-04-04 02:28:29 +00:00
|
|
|
sdf = DPARM_SAFE_DFLT;
|
1999-12-20 01:34:01 +00:00
|
|
|
|
1999-04-04 02:28:29 +00:00
|
|
|
/*
|
|
|
|
* It is not quite clear when this changed over so that
|
1999-12-20 01:34:01 +00:00
|
|
|
* we could force narrow and async, so assume >= 7.55
|
|
|
|
* for i/t F/W and = 4.55 for initiator f/w.
|
1999-04-04 02:28:29 +00:00
|
|
|
*/
|
1999-12-20 01:34:01 +00:00
|
|
|
if ((ISP_FW_REV(4, 55, 0) <= rvf &&
|
|
|
|
(ISP_FW_REV(5, 0, 0) > rvf)) ||
|
|
|
|
(ISP_FW_REV(7, 55, 0) <= rvf)) {
|
1999-04-04 02:28:29 +00:00
|
|
|
sdf |= DPARM_NARROW | DPARM_ASYNC;
|
|
|
|
}
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
1999-02-09 01:07:06 +00:00
|
|
|
mbs.param[0] = MBOX_SET_TARGET_PARAMS;
|
1999-05-11 05:06:55 +00:00
|
|
|
mbs.param[1] = (tgt << 8) | (channel << 15);
|
1999-02-09 01:07:06 +00:00
|
|
|
mbs.param[2] = sdf;
|
1999-03-25 22:52:45 +00:00
|
|
|
mbs.param[3] =
|
|
|
|
(sdp->isp_devparam[tgt].sync_offset << 8) |
|
|
|
|
(sdp->isp_devparam[tgt].sync_period);
|
1998-04-22 17:54:58 +00:00
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
1999-02-09 01:07:06 +00:00
|
|
|
sdf = DPARM_SAFE_DFLT;
|
1998-04-22 17:54:58 +00:00
|
|
|
mbs.param[0] = MBOX_SET_TARGET_PARAMS;
|
1999-05-11 05:06:55 +00:00
|
|
|
mbs.param[1] = (tgt << 8) | (channel << 15);
|
1999-02-09 01:07:06 +00:00
|
|
|
mbs.param[2] = sdf;
|
1999-03-25 22:52:45 +00:00
|
|
|
mbs.param[3] =
|
|
|
|
(sdp->isp_devparam[tgt].sync_offset << 8) |
|
|
|
|
(sdp->isp_devparam[tgt].sync_period);
|
1998-04-22 17:54:58 +00:00
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
1998-09-15 08:42:56 +00:00
|
|
|
PRINTF("%s: failed even to set defaults for "
|
|
|
|
"target %d\n", isp->isp_name, tgt);
|
|
|
|
continue;
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
}
|
1999-05-11 05:06:55 +00:00
|
|
|
|
|
|
|
#if 0
|
1999-03-25 22:52:45 +00:00
|
|
|
/*
|
|
|
|
* We don't update dev_flags with what we've set
|
|
|
|
* because that's not the ultimate goal setting.
|
|
|
|
* If we succeed with the command, we *do* update
|
1999-03-26 00:33:13 +00:00
|
|
|
* cur_dflags by getting target parameters.
|
1999-03-25 22:52:45 +00:00
|
|
|
*/
|
|
|
|
mbs.param[0] = MBOX_GET_TARGET_PARAMS;
|
1999-05-11 05:06:55 +00:00
|
|
|
mbs.param[1] = (tgt << 8) | (channel << 15);
|
1999-03-25 22:52:45 +00:00
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
|
|
|
/*
|
|
|
|
* Urrr.... We'll set cur_dflags to DPARM_SAFE_DFLT so
|
|
|
|
* we don't try and do tags if tags aren't enabled.
|
|
|
|
*/
|
|
|
|
sdp->isp_devparam[tgt].cur_dflags = DPARM_SAFE_DFLT;
|
|
|
|
} else {
|
|
|
|
sdp->isp_devparam[tgt].cur_dflags = mbs.param[2];
|
|
|
|
sdp->isp_devparam[tgt].cur_offset = mbs.param[3] >> 8;
|
|
|
|
sdp->isp_devparam[tgt].cur_period = mbs.param[3] & 0xff;
|
|
|
|
}
|
1999-04-04 02:28:29 +00:00
|
|
|
IDPRINTF(3, ("%s: set flags 0x%x got 0x%x back for target %d\n",
|
|
|
|
isp->isp_name, sdf, mbs.param[2], tgt));
|
1999-12-20 01:34:01 +00:00
|
|
|
|
1999-05-11 05:06:55 +00:00
|
|
|
#else
|
|
|
|
/*
|
|
|
|
* We don't update any information because we need to run
|
|
|
|
* at least one command per target to cause a new state
|
|
|
|
* to be latched.
|
|
|
|
*/
|
|
|
|
#endif
|
1999-03-26 00:33:13 +00:00
|
|
|
/*
|
|
|
|
* Ensure that we don't believe tagged queuing is enabled yet.
|
|
|
|
* It turns out that sometimes the ISP just ignores our
|
|
|
|
* attempts to set parameters for devices that it hasn't
|
|
|
|
* seen yet.
|
|
|
|
*/
|
|
|
|
sdp->isp_devparam[tgt].cur_dflags &= ~DPARM_TQING;
|
1999-12-20 01:34:01 +00:00
|
|
|
if ((ISP_FW_REV(4, 55, 0) <= ISP_FW_REVX(isp->isp_fwrev) &&
|
|
|
|
(ISP_FW_REV(5, 0, 0) > ISP_FW_REVX(isp->isp_fwrev))) ||
|
|
|
|
(ISP_FW_REVX(isp->isp_fwrev) >= ISP_FW_REV(7, 55, 0)))
|
1999-04-04 02:28:29 +00:00
|
|
|
maxlun = 32;
|
|
|
|
else
|
|
|
|
maxlun = 8;
|
1998-09-15 08:42:56 +00:00
|
|
|
for (lun = 0; lun < maxlun; lun++) {
|
1998-04-22 17:54:58 +00:00
|
|
|
mbs.param[0] = MBOX_SET_DEV_QUEUE_PARAMS;
|
1999-05-11 05:06:55 +00:00
|
|
|
mbs.param[1] = (channel << 15) | (tgt << 8) | lun;
|
1998-04-22 17:54:58 +00:00
|
|
|
mbs.param[2] = sdp->isp_max_queue_depth;
|
1998-09-15 08:42:56 +00:00
|
|
|
mbs.param[3] = sdp->isp_devparam[tgt].exc_throttle;
|
1998-04-22 17:54:58 +00:00
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
1998-09-15 08:42:56 +00:00
|
|
|
PRINTF("%s: failed to set device queue "
|
|
|
|
"parameters for target %d, lun %d\n",
|
|
|
|
isp->isp_name, tgt, lun);
|
|
|
|
break;
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
}
|
1999-01-30 07:29:00 +00:00
|
|
|
}
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
/*
|
|
|
|
* Fibre Channel specific initialization.
|
|
|
|
*
|
|
|
|
* Locks are held before coming here.
|
|
|
|
*/
|
1998-04-22 17:54:58 +00:00
|
|
|
static void
|
|
|
|
isp_fibre_init(isp)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
{
|
|
|
|
fcparam *fcp;
|
|
|
|
isp_icb_t *icbp;
|
|
|
|
mbreg_t mbs;
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
int loopid;
|
1998-04-22 17:54:58 +00:00
|
|
|
|
|
|
|
fcp = isp->isp_param;
|
|
|
|
|
1998-12-05 01:33:57 +00:00
|
|
|
/*
|
|
|
|
* For systems that don't have BIOS methods for which
|
|
|
|
* we can easily change the NVRAM based loopid, we'll
|
|
|
|
* override that here. Note that when we initialize
|
|
|
|
* the firmware we may get back a different loopid than
|
|
|
|
* we asked for anyway. XXX This is probably not the
|
|
|
|
* best way to figure this out XXX
|
|
|
|
*/
|
|
|
|
#ifndef __i386__
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
loopid = DEFAULT_LOOPID(isp);
|
1998-12-05 01:33:57 +00:00
|
|
|
#else
|
|
|
|
loopid = fcp->isp_loopid;
|
|
|
|
#endif
|
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
icbp = (isp_icb_t *) fcp->isp_scratch;
|
1999-01-10 02:55:10 +00:00
|
|
|
MEMZERO(icbp, sizeof (*icbp));
|
1998-09-15 08:42:56 +00:00
|
|
|
|
|
|
|
icbp->icb_version = ICB_VERSION1;
|
1998-12-05 01:33:57 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
1999-08-16 19:59:55 +00:00
|
|
|
fcp->isp_fwoptions = ICBOPT_TGT_ENABLE;
|
1998-12-05 01:33:57 +00:00
|
|
|
#else
|
1998-09-15 08:42:56 +00:00
|
|
|
fcp->isp_fwoptions = 0;
|
1998-12-05 01:33:57 +00:00
|
|
|
#endif
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
fcp->isp_fwoptions |= ICBOPT_FAIRNESS;
|
1999-11-21 03:18:22 +00:00
|
|
|
/*
|
|
|
|
* If this is a 2100 < revision 5, we have to turn off FAIRNESS.
|
|
|
|
*/
|
|
|
|
if ((isp->isp_type == ISP_HA_FC_2100) && isp->isp_revision < 5) {
|
|
|
|
fcp->isp_fwoptions &= ~ICBOPT_FAIRNESS;
|
|
|
|
}
|
1998-12-05 01:33:57 +00:00
|
|
|
fcp->isp_fwoptions |= ICBOPT_PDBCHANGE_AE;
|
|
|
|
fcp->isp_fwoptions |= ICBOPT_HARD_ADDRESS;
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
/*
|
1999-08-16 19:59:55 +00:00
|
|
|
* We have to use FULL LOGIN even though it resets the loop too much
|
|
|
|
* because otherwise port database entries don't get updated after
|
|
|
|
* a LIP- this is a known f/w bug.
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
*/
|
1999-08-16 19:59:55 +00:00
|
|
|
if (ISP_FW_REVX(isp->isp_fwrev) < ISP_FW_REV(1, 17, 0)) {
|
|
|
|
fcp->isp_fwoptions |= ICBOPT_FULL_LOGIN;
|
|
|
|
}
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
#ifndef ISP_NO_FASTPOST_FC
|
|
|
|
fcp->isp_fwoptions |= ICBOPT_FAST_POST;
|
|
|
|
#endif
|
|
|
|
if (isp->isp_confopts & ISP_CFG_FULL_DUPLEX)
|
|
|
|
fcp->isp_fwoptions |= ICBOPT_FULL_DUPLEX;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We don't set ICBOPT_PORTNAME because we want our
|
|
|
|
* Node Name && Port Names to be distinct.
|
|
|
|
*/
|
1999-01-30 07:29:00 +00:00
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
icbp->icb_fwoptions = fcp->isp_fwoptions;
|
|
|
|
icbp->icb_maxfrmlen = fcp->isp_maxfrmlen;
|
|
|
|
if (icbp->icb_maxfrmlen < ICB_MIN_FRMLEN ||
|
|
|
|
icbp->icb_maxfrmlen > ICB_MAX_FRMLEN) {
|
|
|
|
PRINTF("%s: bad frame length (%d) from NVRAM- using %d\n",
|
|
|
|
isp->isp_name, fcp->isp_maxfrmlen, ICB_DFLT_FRMLEN);
|
1999-04-04 02:28:29 +00:00
|
|
|
icbp->icb_maxfrmlen = ICB_DFLT_FRMLEN;
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
|
|
|
icbp->icb_maxalloc = fcp->isp_maxalloc;
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
if (icbp->icb_maxalloc < 1) {
|
1999-04-04 02:28:29 +00:00
|
|
|
PRINTF("%s: bad maximum allocation (%d)- using 16\n",
|
|
|
|
isp->isp_name, fcp->isp_maxalloc);
|
|
|
|
icbp->icb_maxalloc = 16;
|
|
|
|
}
|
1998-09-15 08:42:56 +00:00
|
|
|
icbp->icb_execthrottle = fcp->isp_execthrottle;
|
1999-04-04 02:28:29 +00:00
|
|
|
if (icbp->icb_execthrottle < 1) {
|
|
|
|
PRINTF("%s: bad execution throttle of %d- using 16\n",
|
|
|
|
isp->isp_name, fcp->isp_execthrottle);
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
icbp->icb_execthrottle = ICB_DFLT_THROTTLE;
|
1999-04-04 02:28:29 +00:00
|
|
|
}
|
1998-09-15 08:42:56 +00:00
|
|
|
icbp->icb_retry_delay = fcp->isp_retry_delay;
|
|
|
|
icbp->icb_retry_count = fcp->isp_retry_count;
|
1998-12-05 01:46:40 +00:00
|
|
|
icbp->icb_hardaddr = loopid;
|
2000-01-03 23:52:41 +00:00
|
|
|
icbp->icb_logintime = 60; /* 60 second login timeout */
|
1998-09-15 08:42:56 +00:00
|
|
|
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
if (fcp->isp_nodewwn) {
|
|
|
|
u_int64_t pn;
|
|
|
|
MAKE_NODE_NAME_FROM_WWN(icbp->icb_nodename, fcp->isp_nodewwn);
|
|
|
|
if (fcp->isp_portwwn) {
|
|
|
|
pn = fcp->isp_portwwn;
|
|
|
|
} else {
|
|
|
|
pn = fcp->isp_nodewwn |
|
|
|
|
(((u_int64_t)(isp->isp_unit+1)) << 56);
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* If the top nibble is 2, we can construct a port name
|
|
|
|
* from the node name by setting a nonzero instance in
|
|
|
|
* bits 56..59. Otherwise, we need to make it identical
|
|
|
|
* to Node name...
|
|
|
|
*/
|
|
|
|
if ((fcp->isp_nodewwn >> 60) == 2) {
|
|
|
|
MAKE_NODE_NAME_FROM_WWN(icbp->icb_portname, pn);
|
|
|
|
} else {
|
|
|
|
MAKE_NODE_NAME_FROM_WWN(icbp->icb_portname,
|
|
|
|
fcp->isp_nodewwn);
|
1999-04-04 02:28:29 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
fcp->isp_fwoptions &= ~(ICBOPT_USE_PORTNAME|ICBOPT_FULL_LOGIN);
|
1998-12-05 01:33:57 +00:00
|
|
|
}
|
1998-09-15 08:42:56 +00:00
|
|
|
icbp->icb_rqstqlen = RQUEST_QUEUE_LEN;
|
|
|
|
icbp->icb_rsltqlen = RESULT_QUEUE_LEN;
|
1999-04-04 02:28:29 +00:00
|
|
|
icbp->icb_rqstaddr[RQRSP_ADDR0015] = DMA_LSW(isp->isp_rquest_dma);
|
|
|
|
icbp->icb_rqstaddr[RQRSP_ADDR1631] = DMA_MSW(isp->isp_rquest_dma);
|
|
|
|
icbp->icb_respaddr[RQRSP_ADDR0015] = DMA_LSW(isp->isp_result_dma);
|
|
|
|
icbp->icb_respaddr[RQRSP_ADDR1631] = DMA_MSW(isp->isp_result_dma);
|
1999-10-17 18:58:22 +00:00
|
|
|
ISP_SWIZZLE_ICB(isp, icbp);
|
1999-08-16 19:59:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Do this *before* initializing the firmware.
|
|
|
|
*/
|
|
|
|
isp_mark_getpdb_all(isp);
|
|
|
|
fcp->isp_fwstate = FW_CONFIG_WAIT;
|
|
|
|
fcp->isp_loopstate = LOOP_NIL;
|
|
|
|
|
1999-10-17 18:58:22 +00:00
|
|
|
MemoryBarrier();
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
for (;;) {
|
1998-09-15 08:42:56 +00:00
|
|
|
mbs.param[0] = MBOX_INIT_FIRMWARE;
|
|
|
|
mbs.param[1] = 0;
|
1999-04-04 02:28:29 +00:00
|
|
|
mbs.param[2] = DMA_MSW(fcp->isp_scdma);
|
|
|
|
mbs.param[3] = DMA_LSW(fcp->isp_scdma);
|
1998-09-15 08:42:56 +00:00
|
|
|
mbs.param[4] = 0;
|
|
|
|
mbs.param[5] = 0;
|
|
|
|
mbs.param[6] = 0;
|
|
|
|
mbs.param[7] = 0;
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
|
|
|
PRINTF("%s: INIT FIRMWARE failed (code 0x%x)\n",
|
|
|
|
isp->isp_name, mbs.param[0]);
|
1999-08-16 19:59:55 +00:00
|
|
|
if (mbs.param[0] & 0x8000) {
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
SYS_DELAY(1000);
|
|
|
|
continue;
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
break;
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
isp->isp_reqidx = isp->isp_reqodx = 0;
|
1998-04-22 17:54:58 +00:00
|
|
|
isp->isp_residx = 0;
|
1999-03-17 05:04:39 +00:00
|
|
|
isp->isp_sendmarker = 1;
|
1998-04-22 17:54:58 +00:00
|
|
|
|
|
|
|
/*
|
1999-03-17 05:04:39 +00:00
|
|
|
* Whatever happens, we're now committed to being here.
|
|
|
|
*/
|
|
|
|
isp->isp_state = ISP_INITSTATE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Fibre Channel Support- get the port database for the id.
|
|
|
|
*
|
|
|
|
* Locks are held before coming here. Return 0 if success,
|
|
|
|
* else failure.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
isp_mark_getpdb_all(isp)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
{
|
|
|
|
fcparam *fcp = (fcparam *) isp->isp_param;
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
int i;
|
|
|
|
for (i = 0; i < MAX_FC_TARG; i++) {
|
|
|
|
fcp->portdb[i].valid = 0;
|
1999-03-17 05:04:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
isp_getpdb(isp, id, pdbp)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
int id;
|
|
|
|
isp_pdb_t *pdbp;
|
|
|
|
{
|
|
|
|
fcparam *fcp = (fcparam *) isp->isp_param;
|
|
|
|
mbreg_t mbs;
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
|
1999-03-17 05:04:39 +00:00
|
|
|
mbs.param[0] = MBOX_GET_PORT_DB;
|
|
|
|
mbs.param[1] = id << 8;
|
1999-04-04 02:28:29 +00:00
|
|
|
mbs.param[2] = DMA_MSW(fcp->isp_scdma);
|
|
|
|
mbs.param[3] = DMA_LSW(fcp->isp_scdma);
|
1999-03-25 22:52:45 +00:00
|
|
|
/*
|
|
|
|
* Unneeded. For the 2100, except for initializing f/w, registers
|
|
|
|
* 4/5 have to not be written to.
|
|
|
|
* mbs.param[4] = 0;
|
|
|
|
* mbs.param[5] = 0;
|
|
|
|
*
|
|
|
|
*/
|
1999-03-17 05:04:39 +00:00
|
|
|
mbs.param[6] = 0;
|
|
|
|
mbs.param[7] = 0;
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
switch (mbs.param[0]) {
|
|
|
|
case MBOX_COMMAND_COMPLETE:
|
|
|
|
MemoryBarrier();
|
1999-10-17 18:58:22 +00:00
|
|
|
ISP_UNSWIZZLE_AND_COPY_PDBP(isp, pdbp, fcp->isp_scratch);
|
1999-03-17 05:04:39 +00:00
|
|
|
break;
|
|
|
|
case MBOX_HOST_INTERFACE_ERROR:
|
|
|
|
PRINTF("%s: DMA error getting port database\n", isp->isp_name);
|
|
|
|
return (-1);
|
|
|
|
case MBOX_COMMAND_PARAM_ERROR:
|
|
|
|
/* Not Logged In */
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
IDPRINTF(3, ("%s: Param Error on Get Port Database for id %d\n",
|
|
|
|
isp->isp_name, id));
|
1999-03-17 05:04:39 +00:00
|
|
|
return (-1);
|
|
|
|
default:
|
|
|
|
PRINTF("%s: error 0x%x getting port database for ID %d\n",
|
|
|
|
isp->isp_name, mbs.param[0], id);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
static u_int64_t
|
|
|
|
isp_get_portname(isp, loopid, nodename)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
int loopid;
|
|
|
|
int nodename;
|
|
|
|
{
|
|
|
|
u_int64_t wwn = 0;
|
|
|
|
mbreg_t mbs;
|
|
|
|
|
|
|
|
mbs.param[0] = MBOX_GET_PORT_NAME;
|
|
|
|
mbs.param[1] = loopid << 8;
|
|
|
|
if (nodename)
|
|
|
|
mbs.param[1] |= 1;
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
|
|
|
|
wwn =
|
|
|
|
(((u_int64_t)(mbs.param[2] & 0xff)) << 56) |
|
|
|
|
(((u_int64_t)(mbs.param[2] >> 8)) << 48) |
|
|
|
|
(((u_int64_t)(mbs.param[3] & 0xff)) << 40) |
|
|
|
|
(((u_int64_t)(mbs.param[3] >> 8)) << 32) |
|
|
|
|
(((u_int64_t)(mbs.param[6] & 0xff)) << 24) |
|
|
|
|
(((u_int64_t)(mbs.param[6] >> 8)) << 16) |
|
|
|
|
(((u_int64_t)(mbs.param[7] & 0xff)) << 8) |
|
|
|
|
(((u_int64_t)(mbs.param[7] >> 8)));
|
|
|
|
}
|
|
|
|
return (wwn);
|
|
|
|
}
|
|
|
|
|
1999-03-17 05:04:39 +00:00
|
|
|
/*
|
|
|
|
* Make sure we have good FC link and know our Loop ID.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int
|
1999-03-25 22:52:45 +00:00
|
|
|
isp_fclink_test(isp, waitdelay)
|
1999-03-17 05:04:39 +00:00
|
|
|
struct ispsoftc *isp;
|
1999-03-25 22:52:45 +00:00
|
|
|
int waitdelay;
|
1999-03-17 05:04:39 +00:00
|
|
|
{
|
1999-10-17 18:58:22 +00:00
|
|
|
static char *toponames[] = {
|
|
|
|
"Private Loop",
|
|
|
|
"FL Port",
|
|
|
|
"N-Port to N-Port",
|
|
|
|
"F Port"
|
|
|
|
};
|
|
|
|
char *tname;
|
1999-03-17 05:04:39 +00:00
|
|
|
mbreg_t mbs;
|
1999-10-17 18:58:22 +00:00
|
|
|
int count, topo = -1;
|
1999-03-17 05:04:39 +00:00
|
|
|
u_int8_t lwfs;
|
|
|
|
fcparam *fcp;
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
#if defined(ISP2100_FABRIC)
|
|
|
|
isp_pdb_t pdb;
|
|
|
|
#endif
|
1999-03-17 05:04:39 +00:00
|
|
|
fcp = isp->isp_param;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Wait up to N microseconds for F/W to go to a ready state.
|
1998-04-22 17:54:58 +00:00
|
|
|
*/
|
|
|
|
lwfs = FW_CONFIG_WAIT;
|
1999-03-25 22:52:45 +00:00
|
|
|
for (count = 0; count < waitdelay; count += 100) {
|
1998-04-22 17:54:58 +00:00
|
|
|
isp_fw_state(isp);
|
|
|
|
if (lwfs != fcp->isp_fwstate) {
|
1998-09-17 23:20:29 +00:00
|
|
|
PRINTF("%s: Firmware State %s -> %s\n",
|
1998-12-05 01:33:57 +00:00
|
|
|
isp->isp_name, isp2100_fw_statename((int)lwfs),
|
|
|
|
isp2100_fw_statename((int)fcp->isp_fwstate));
|
1998-04-22 17:54:58 +00:00
|
|
|
lwfs = fcp->isp_fwstate;
|
|
|
|
}
|
|
|
|
if (fcp->isp_fwstate == FW_READY) {
|
|
|
|
break;
|
|
|
|
}
|
1999-03-17 05:04:39 +00:00
|
|
|
SYS_DELAY(100); /* wait 100 microseconds */
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1999-03-17 05:04:39 +00:00
|
|
|
* If we haven't gone to 'ready' state, return.
|
1998-04-22 17:54:58 +00:00
|
|
|
*/
|
1999-03-17 05:04:39 +00:00
|
|
|
if (fcp->isp_fwstate != FW_READY) {
|
|
|
|
return (-1);
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
1999-03-25 22:52:45 +00:00
|
|
|
|
1999-03-17 05:04:39 +00:00
|
|
|
/*
|
|
|
|
* Get our Loop ID (if possible). We really need to have it.
|
|
|
|
*/
|
|
|
|
mbs.param[0] = MBOX_GET_LOOP_ID;
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
1999-03-25 22:52:45 +00:00
|
|
|
PRINTF("%s: GET LOOP ID failed\n", isp->isp_name);
|
1999-03-17 05:04:39 +00:00
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
fcp->isp_loopid = mbs.param[1];
|
1999-11-21 03:18:22 +00:00
|
|
|
if (isp->isp_type == ISP_HA_FC_2200) {
|
1999-10-17 18:58:22 +00:00
|
|
|
if (ISP_FW_REVX(isp->isp_fwrev) >= ISP_FW_REV(2, 0, 14)) {
|
|
|
|
topo = (int) mbs.param[6];
|
|
|
|
}
|
|
|
|
} else if (isp->isp_type == ISP_HA_FC_2100) {
|
|
|
|
if (ISP_FW_REVX(isp->isp_fwrev) >= ISP_FW_REV(1, 17, 26)) {
|
|
|
|
topo = (int) mbs.param[6];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (topo < 0 || topo > 3)
|
|
|
|
tname = "unknown";
|
|
|
|
else
|
|
|
|
tname = toponames[topo];
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If we're not on a fabric, the low 8 bits will be our AL_PA.
|
|
|
|
* If we're on a fabric, the low 8 bits will still be our AL_PA.
|
|
|
|
*/
|
1999-03-17 05:04:39 +00:00
|
|
|
fcp->isp_alpa = mbs.param[2];
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
#if defined(ISP2100_FABRIC)
|
1999-08-16 19:59:55 +00:00
|
|
|
fcp->isp_onfabric = 0;
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
if (isp_getpdb(isp, FL_PORT_ID, &pdb) == 0) {
|
|
|
|
fcp->isp_portid = mbs.param[2] | (((int)mbs.param[3]) << 16);
|
|
|
|
fcp->isp_onfabric = 1;
|
1999-10-17 18:58:22 +00:00
|
|
|
CFGPRINTF("%s: Loop ID %d, AL_PA 0x%x, Port ID 0x%x Loop State "
|
|
|
|
"0x%x topology %s\n", isp->isp_name, fcp->isp_loopid,
|
|
|
|
fcp->isp_alpa, fcp->isp_portid, fcp->isp_loopstate, tname);
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Make sure we're logged out of all fabric devices.
|
|
|
|
*/
|
|
|
|
for (count = FC_SNS_ID+1; count < MAX_FC_TARG; count++) {
|
|
|
|
struct lportdb *lp = &fcp->portdb[count];
|
|
|
|
if (lp->valid == 0 || lp->fabdev == 0)
|
|
|
|
continue;
|
|
|
|
PRINTF("%s: logging out target %d at Loop ID %d "
|
|
|
|
"(port id 0x%x)\n", isp->isp_name, count,
|
|
|
|
lp->loopid, lp->portid);
|
|
|
|
mbs.param[0] = MBOX_FABRIC_LOGOUT;
|
|
|
|
mbs.param[1] = lp->loopid << 8;
|
|
|
|
mbs.param[2] = 0;
|
|
|
|
mbs.param[3] = 0;
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
#endif
|
1999-10-17 18:58:22 +00:00
|
|
|
CFGPRINTF("%s: Loop ID %d, ALPA 0x%x Loop State 0x%x topology %s\n",
|
|
|
|
isp->isp_name, fcp->isp_loopid, fcp->isp_alpa, fcp->isp_loopstate,
|
|
|
|
tname);
|
1999-03-17 05:04:39 +00:00
|
|
|
return (0);
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Compare two local port db entities and return 1 if they're the same, else 0.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int
|
|
|
|
isp_same_lportdb(a, b)
|
|
|
|
struct lportdb *a, *b;
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* We decide two lports are the same if they have non-zero and
|
|
|
|
* identical port WWNs and identical loop IDs.
|
|
|
|
*/
|
1999-03-17 05:04:39 +00:00
|
|
|
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
if (a->port_wwn == 0 || a->port_wwn != b->port_wwn ||
|
|
|
|
a->loopid != b->loopid) {
|
|
|
|
return (0);
|
|
|
|
} else {
|
|
|
|
return (1);
|
|
|
|
}
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
/*
|
|
|
|
* Synchronize our soft copy of the port database with what the f/w thinks
|
|
|
|
* (with a view toward possibly for a specific target....)
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int
|
|
|
|
isp_pdb_sync(isp, target)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
int target;
|
|
|
|
{
|
1999-10-17 18:58:22 +00:00
|
|
|
struct lportdb *lp, *tport;
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
fcparam *fcp = isp->isp_param;
|
|
|
|
isp_pdb_t pdb;
|
|
|
|
int loopid, lim;
|
|
|
|
|
|
|
|
#ifdef ISP2100_FABRIC
|
|
|
|
/*
|
|
|
|
* XXX: If we do this *after* building up our local port database,
|
|
|
|
* XXX: the commands simply don't work.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* (Re)discover all fabric devices
|
|
|
|
*/
|
|
|
|
if (fcp->isp_onfabric)
|
|
|
|
(void) isp_scan_fabric(isp);
|
|
|
|
#endif
|
1999-08-16 19:59:55 +00:00
|
|
|
|
|
|
|
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
/*
|
|
|
|
* Run through the local loop ports and get port database info
|
|
|
|
* for each loop ID.
|
|
|
|
*
|
|
|
|
* There's a somewhat unexplained situation where the f/w passes back
|
|
|
|
* the wrong database entity- if that happens, just restart (up to
|
|
|
|
* FL_PORT_ID times).
|
|
|
|
*/
|
1999-10-17 18:58:22 +00:00
|
|
|
tport = fcp->tport;
|
2000-01-03 23:52:41 +00:00
|
|
|
|
1999-11-21 03:18:22 +00:00
|
|
|
/*
|
|
|
|
* make sure the temp port database is clean...
|
|
|
|
*/
|
1999-08-16 19:59:55 +00:00
|
|
|
MEMZERO((void *) tport, sizeof (tport));
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
for (lim = loopid = 0; loopid < FL_PORT_ID; loopid++) {
|
|
|
|
lp = &tport[loopid];
|
|
|
|
lp->node_wwn = isp_get_portname(isp, loopid, 1);
|
|
|
|
if (lp->node_wwn == 0)
|
|
|
|
continue;
|
|
|
|
lp->port_wwn = isp_get_portname(isp, loopid, 0);
|
|
|
|
if (lp->port_wwn == 0) {
|
|
|
|
lp->node_wwn = 0;
|
|
|
|
continue;
|
|
|
|
}
|
1999-08-16 19:59:55 +00:00
|
|
|
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
/*
|
|
|
|
* Get an entry....
|
|
|
|
*/
|
|
|
|
if (isp_getpdb(isp, loopid, &pdb) != 0) {
|
|
|
|
continue;
|
|
|
|
}
|
1999-08-16 19:59:55 +00:00
|
|
|
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
/*
|
|
|
|
* If the returned database element doesn't match what we
|
|
|
|
* asked for, restart the process entirely (up to a point...).
|
|
|
|
*/
|
|
|
|
if (pdb.pdb_loopid != loopid) {
|
1999-11-21 03:18:22 +00:00
|
|
|
IDPRINTF(1, ("%s: wankage (%d != %d)\n",
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
isp->isp_name, pdb.pdb_loopid, loopid));
|
|
|
|
loopid = 0;
|
|
|
|
if (lim++ < FL_PORT_ID) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
PRINTF("%s: giving up on synchronizing the port "
|
|
|
|
"database\n", isp->isp_name);
|
|
|
|
return (-1);
|
|
|
|
}
|
1999-08-16 19:59:55 +00:00
|
|
|
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
/*
|
|
|
|
* Save the pertinent info locally.
|
|
|
|
*/
|
|
|
|
lp->node_wwn =
|
|
|
|
(((u_int64_t)pdb.pdb_nodename[0]) << 56) |
|
|
|
|
(((u_int64_t)pdb.pdb_nodename[1]) << 48) |
|
|
|
|
(((u_int64_t)pdb.pdb_nodename[2]) << 40) |
|
|
|
|
(((u_int64_t)pdb.pdb_nodename[3]) << 32) |
|
|
|
|
(((u_int64_t)pdb.pdb_nodename[4]) << 24) |
|
|
|
|
(((u_int64_t)pdb.pdb_nodename[5]) << 16) |
|
|
|
|
(((u_int64_t)pdb.pdb_nodename[6]) << 8) |
|
|
|
|
(((u_int64_t)pdb.pdb_nodename[7]));
|
|
|
|
lp->port_wwn =
|
|
|
|
(((u_int64_t)pdb.pdb_portname[0]) << 56) |
|
|
|
|
(((u_int64_t)pdb.pdb_portname[1]) << 48) |
|
|
|
|
(((u_int64_t)pdb.pdb_portname[2]) << 40) |
|
|
|
|
(((u_int64_t)pdb.pdb_portname[3]) << 32) |
|
|
|
|
(((u_int64_t)pdb.pdb_portname[4]) << 24) |
|
|
|
|
(((u_int64_t)pdb.pdb_portname[5]) << 16) |
|
|
|
|
(((u_int64_t)pdb.pdb_portname[6]) << 8) |
|
|
|
|
(((u_int64_t)pdb.pdb_portname[7]));
|
|
|
|
lp->roles =
|
|
|
|
(pdb.pdb_prli_svc3 & SVC3_ROLE_MASK) >> SVC3_ROLE_SHIFT;
|
|
|
|
lp->portid = BITS2WORD(pdb.pdb_portid_bits);
|
|
|
|
lp->loopid = pdb.pdb_loopid;
|
|
|
|
/*
|
|
|
|
* Do a quick check to see whether this matches the saved port
|
|
|
|
* database for the same loopid. We do this here to save
|
|
|
|
* searching later (if possible). Note that this fails over
|
|
|
|
* time as things shuffle on the loop- we get the current
|
|
|
|
* loop state (where loop id as an index matches loop id in
|
|
|
|
* use) and then compare it to our saved database which
|
|
|
|
* never shifts.
|
|
|
|
*/
|
2000-01-03 23:52:41 +00:00
|
|
|
if (target >= 0 && isp_same_lportdb(lp, &fcp->portdb[target])) {
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
lp->valid = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If we get this far, we've settled our differences with the f/w
|
|
|
|
* and we can say that the loop state is ready.
|
|
|
|
*/
|
|
|
|
fcp->isp_loopstate = LOOP_READY;
|
|
|
|
|
1999-08-16 19:59:55 +00:00
|
|
|
/*
|
|
|
|
* Mark all of the permanent local loop database entries as invalid.
|
|
|
|
*/
|
|
|
|
for (loopid = 0; loopid < FL_PORT_ID; loopid++) {
|
|
|
|
fcp->portdb[loopid].valid = 0;
|
|
|
|
}
|
|
|
|
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
/*
|
|
|
|
* Now merge our local copy of the port database into our saved copy.
|
|
|
|
* Notify the outer layers of new devices arriving.
|
|
|
|
*/
|
|
|
|
for (loopid = 0; loopid < FL_PORT_ID; loopid++) {
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If we don't have a non-zero Port WWN, we're not here.
|
|
|
|
*/
|
|
|
|
if (tport[loopid].port_wwn == 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If we've already marked our tmp copy as valid,
|
|
|
|
* this means that we've decided that it's the
|
1999-08-16 19:59:55 +00:00
|
|
|
* same as our saved data base. This didn't include
|
|
|
|
* the 'valid' marking so we have set that here.
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
*/
|
|
|
|
if (tport[loopid].valid) {
|
|
|
|
fcp->portdb[loopid].valid = 1;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For the purposes of deciding whether this is the
|
|
|
|
* 'same' device or not, we only search for an identical
|
|
|
|
* Port WWN. Node WWNs may or may not be the same as
|
|
|
|
* the Port WWN, and there may be multiple different
|
|
|
|
* Port WWNs with the same Node WWN. It would be chaos
|
|
|
|
* to have multiple identical Port WWNs, so we don't
|
|
|
|
* allow that.
|
|
|
|
*/
|
|
|
|
|
|
|
|
for (i = 0; i < FL_PORT_ID; i++) {
|
|
|
|
int j;
|
|
|
|
if (fcp->portdb[i].port_wwn == 0)
|
|
|
|
continue;
|
|
|
|
if (fcp->portdb[i].port_wwn != tport[loopid].port_wwn)
|
|
|
|
continue;
|
|
|
|
/*
|
|
|
|
* We found this WWN elsewhere- it's changed
|
|
|
|
* loopids then. We don't change it's actual
|
|
|
|
* position in our cached port database- we
|
|
|
|
* just change the actual loop ID we'd use.
|
|
|
|
*/
|
|
|
|
if (fcp->portdb[i].loopid != loopid) {
|
1999-08-16 19:59:55 +00:00
|
|
|
PRINTF("%s: Target ID %d Loop 0x%x (Port 0x%x) "
|
|
|
|
"=> Loop 0x%x (Port 0x%x) \n",
|
|
|
|
isp->isp_name, i, fcp->portdb[i].loopid,
|
|
|
|
fcp->portdb[i].portid, loopid,
|
|
|
|
tport[loopid].portid);
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
}
|
1999-08-16 19:59:55 +00:00
|
|
|
fcp->portdb[i].portid = tport[loopid].portid;
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
fcp->portdb[i].loopid = loopid;
|
|
|
|
fcp->portdb[i].valid = 1;
|
1999-08-16 19:59:55 +00:00
|
|
|
/*
|
|
|
|
* XXX: Should we also propagate roles in case they
|
|
|
|
* XXX: changed?
|
|
|
|
*/
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Now make sure this Port WWN doesn't exist elsewhere
|
|
|
|
* in the port database.
|
|
|
|
*/
|
|
|
|
for (j = i+1; j < FL_PORT_ID; j++) {
|
|
|
|
if (fcp->portdb[i].port_wwn !=
|
|
|
|
fcp->portdb[j].port_wwn) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
PRINTF("%s: Target ID %d Duplicates Target ID "
|
|
|
|
"%d- killing off both\n",
|
|
|
|
isp->isp_name, j, i);
|
|
|
|
/*
|
|
|
|
* Invalidate the 'old' *and* 'new' ones.
|
|
|
|
* This is really harsh and not quite right,
|
|
|
|
* but if this happens, we really don't know
|
|
|
|
* who is what at this point.
|
|
|
|
*/
|
|
|
|
fcp->portdb[i].valid = 0;
|
|
|
|
fcp->portdb[j].valid = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If we didn't traverse the entire port database,
|
|
|
|
* then we found (and remapped) an existing entry.
|
|
|
|
* No need to notify anyone- go for the next one.
|
|
|
|
*/
|
|
|
|
if (i < FL_PORT_ID) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We've not found this Port WWN anywhere. It's a new entry.
|
|
|
|
* See if we can leave it where it is (with target == loopid).
|
|
|
|
*/
|
|
|
|
if (fcp->portdb[loopid].port_wwn != 0) {
|
|
|
|
for (lim = 0; lim < FL_PORT_ID; lim++) {
|
|
|
|
if (fcp->portdb[lim].port_wwn == 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* "Cannot Happen" */
|
|
|
|
if (lim == FL_PORT_ID) {
|
|
|
|
PRINTF("%s: remap overflow?\n", isp->isp_name);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
i = lim;
|
|
|
|
} else {
|
|
|
|
i = loopid;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* NB: The actual loopid we use here is loopid- we may
|
|
|
|
* in fact be at a completely different index (target).
|
|
|
|
*/
|
|
|
|
fcp->portdb[i].loopid = loopid;
|
|
|
|
fcp->portdb[i].port_wwn = tport[loopid].port_wwn;
|
|
|
|
fcp->portdb[i].node_wwn = tport[loopid].node_wwn;
|
|
|
|
fcp->portdb[i].roles = tport[loopid].roles;
|
|
|
|
fcp->portdb[i].portid = tport[loopid].portid;
|
|
|
|
fcp->portdb[i].valid = 1;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Tell the outside world we've arrived.
|
|
|
|
*/
|
|
|
|
(void) isp_async(isp, ISPASYNC_PDB_CHANGED, &i);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Now find all previously used targets that are now invalid and
|
|
|
|
* notify the outer layers that they're gone.
|
|
|
|
*/
|
|
|
|
for (lp = fcp->portdb; lp < &fcp->portdb[FL_PORT_ID]; lp++) {
|
|
|
|
if (lp->valid || lp->port_wwn == 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/*
|
1999-11-21 03:18:22 +00:00
|
|
|
* Tell the outside world we've gone away.
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
*/
|
|
|
|
loopid = lp - fcp->portdb;
|
|
|
|
(void) isp_async(isp, ISPASYNC_PDB_CHANGED, &loopid);
|
|
|
|
MEMZERO((void *) lp, sizeof (*lp));
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef ISP2100_FABRIC
|
|
|
|
/*
|
|
|
|
* Now log in any fabric devices
|
|
|
|
*/
|
|
|
|
for (lp = &fcp->portdb[FC_SNS_ID+1];
|
|
|
|
lp < &fcp->portdb[MAX_FC_TARG]; lp++) {
|
|
|
|
mbreg_t mbs;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Nothing here?
|
|
|
|
*/
|
|
|
|
if (lp->port_wwn == 0)
|
|
|
|
continue;
|
|
|
|
/*
|
|
|
|
* Don't try to log into yourself.
|
|
|
|
*/
|
|
|
|
if (lp->portid == fcp->isp_portid)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Force a logout.
|
|
|
|
*/
|
1999-08-16 19:59:55 +00:00
|
|
|
lp->loopid = loopid = lp - fcp->portdb;
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
mbs.param[0] = MBOX_FABRIC_LOGOUT;
|
|
|
|
mbs.param[1] = lp->loopid << 8;
|
|
|
|
mbs.param[2] = 0;
|
|
|
|
mbs.param[3] = 0;
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* And log in....
|
|
|
|
*/
|
|
|
|
mbs.param[0] = MBOX_FABRIC_LOGIN;
|
|
|
|
mbs.param[1] = lp->loopid << 8;
|
|
|
|
mbs.param[2] = lp->portid >> 16;
|
|
|
|
mbs.param[3] = lp->portid & 0xffff;
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
1999-11-21 03:18:22 +00:00
|
|
|
switch (mbs.param[0]) {
|
|
|
|
case MBOX_COMMAND_COMPLETE:
|
|
|
|
break;
|
|
|
|
case MBOX_COMMAND_ERROR:
|
|
|
|
switch (mbs.param[1]) {
|
|
|
|
case 1:
|
|
|
|
PRINTF("%s: no loop\n", isp->isp_name);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
PRINTF("%s: IOCB buffer could not be alloced\n",
|
|
|
|
isp->isp_name);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
PRINTF("%s: could not alloc xchange resource\n",
|
|
|
|
isp->isp_name);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
PRINTF("%s: ELS timeout\n", isp->isp_name);
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
PRINTF("%s: no fabric port\n", isp->isp_name);
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
PRINTF("%s: remote device cannot be a target\n",
|
|
|
|
isp->isp_name);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
1999-08-16 19:59:55 +00:00
|
|
|
}
|
1999-11-21 03:18:22 +00:00
|
|
|
continue;
|
|
|
|
default:
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
lp->valid = 1;
|
|
|
|
lp->fabdev = 1;
|
|
|
|
if (isp_getpdb(isp, loopid, &pdb) != 0) {
|
|
|
|
/*
|
|
|
|
* Be kind...
|
|
|
|
*/
|
|
|
|
lp->roles = (SVC3_TGT_ROLE >> SVC3_ROLE_SHIFT);
|
|
|
|
PRINTF("%s: Faked PortID 0x%x into LoopID %d\n",
|
|
|
|
isp->isp_name, lp->portid, lp->loopid);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (pdb.pdb_loopid != lp->loopid) {
|
|
|
|
lp->roles = (SVC3_TGT_ROLE >> SVC3_ROLE_SHIFT);
|
|
|
|
PRINTF("%s: Wanked PortID 0x%x to LoopID %d\n",
|
|
|
|
isp->isp_name, lp->portid, lp->loopid);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
lp->roles =
|
|
|
|
(pdb.pdb_prli_svc3 & SVC3_ROLE_MASK) >> SVC3_ROLE_SHIFT;
|
|
|
|
lp->portid = BITS2WORD(pdb.pdb_portid_bits);
|
|
|
|
lp->loopid = loopid;
|
|
|
|
lp->node_wwn =
|
|
|
|
(((u_int64_t)pdb.pdb_nodename[0]) << 56) |
|
|
|
|
(((u_int64_t)pdb.pdb_nodename[1]) << 48) |
|
|
|
|
(((u_int64_t)pdb.pdb_nodename[2]) << 40) |
|
|
|
|
(((u_int64_t)pdb.pdb_nodename[3]) << 32) |
|
|
|
|
(((u_int64_t)pdb.pdb_nodename[4]) << 24) |
|
|
|
|
(((u_int64_t)pdb.pdb_nodename[5]) << 16) |
|
|
|
|
(((u_int64_t)pdb.pdb_nodename[6]) << 8) |
|
|
|
|
(((u_int64_t)pdb.pdb_nodename[7]));
|
|
|
|
lp->port_wwn =
|
|
|
|
(((u_int64_t)pdb.pdb_portname[0]) << 56) |
|
|
|
|
(((u_int64_t)pdb.pdb_portname[1]) << 48) |
|
|
|
|
(((u_int64_t)pdb.pdb_portname[2]) << 40) |
|
|
|
|
(((u_int64_t)pdb.pdb_portname[3]) << 32) |
|
|
|
|
(((u_int64_t)pdb.pdb_portname[4]) << 24) |
|
|
|
|
(((u_int64_t)pdb.pdb_portname[5]) << 16) |
|
|
|
|
(((u_int64_t)pdb.pdb_portname[6]) << 8) |
|
|
|
|
(((u_int64_t)pdb.pdb_portname[7]));
|
|
|
|
/*
|
|
|
|
* Check to make sure this all makes sense.
|
|
|
|
*/
|
|
|
|
if (lp->node_wwn && lp->port_wwn) {
|
|
|
|
(void) isp_async(isp, ISPASYNC_PDB_CHANGED, &loopid);
|
|
|
|
continue;
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
}
|
1999-11-21 03:18:22 +00:00
|
|
|
lp->fabdev = lp->valid = 0;
|
|
|
|
PRINTF("%s: Target %d (Loop 0x%x) Port ID 0x%x lost its WWN\n",
|
|
|
|
isp->isp_name, loopid, lp->loopid, lp->portid);
|
|
|
|
mbs.param[0] = MBOX_FABRIC_LOGOUT;
|
|
|
|
mbs.param[1] = lp->loopid << 8;
|
|
|
|
mbs.param[2] = 0;
|
|
|
|
mbs.param[3] = 0;
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
}
|
|
|
|
#endif
|
2000-01-03 23:52:41 +00:00
|
|
|
/*
|
|
|
|
* If we get here, we've for sure seen not only a valid loop
|
|
|
|
* but know what is or isn't on it, so mark this for usage
|
|
|
|
* in ispscsicmd.
|
|
|
|
*/
|
|
|
|
fcp->loop_seen_once = 1;
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef ISP2100_FABRIC
|
|
|
|
static int
|
|
|
|
isp_scan_fabric(isp)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
{
|
|
|
|
fcparam *fcp = isp->isp_param;
|
|
|
|
u_int32_t portid, first_nz_portid;
|
|
|
|
sns_screq_t *reqp;
|
|
|
|
sns_scrsp_t *resp;
|
|
|
|
mbreg_t mbs;
|
|
|
|
int hicap;
|
|
|
|
|
|
|
|
reqp = (sns_screq_t *) fcp->isp_scratch;
|
|
|
|
resp = (sns_scrsp_t *) (&((char *)fcp->isp_scratch)[0x100]);
|
|
|
|
first_nz_portid = portid = fcp->isp_portid;
|
|
|
|
|
|
|
|
for (hicap = 0; hicap < 1024; hicap++) {
|
|
|
|
MEMZERO((void *) reqp, SNS_GAN_REQ_SIZE);
|
|
|
|
reqp->snscb_rblen = SNS_GAN_RESP_SIZE >> 1;
|
|
|
|
reqp->snscb_addr[RQRSP_ADDR0015] =
|
|
|
|
DMA_LSW(fcp->isp_scdma + 0x100);
|
|
|
|
reqp->snscb_addr[RQRSP_ADDR1631] =
|
|
|
|
DMA_MSW(fcp->isp_scdma + 0x100);
|
|
|
|
reqp->snscb_sblen = 6;
|
|
|
|
reqp->snscb_data[0] = SNS_GAN;
|
|
|
|
reqp->snscb_data[4] = portid & 0xffff;
|
|
|
|
reqp->snscb_data[5] = (portid >> 16) & 0xff;
|
1999-10-17 18:58:22 +00:00
|
|
|
ISP_SWIZZLE_SNS_REQ(isp, reqp);
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
mbs.param[0] = MBOX_SEND_SNS;
|
|
|
|
mbs.param[1] = SNS_GAN_REQ_SIZE >> 1;
|
|
|
|
mbs.param[2] = DMA_MSW(fcp->isp_scdma);
|
|
|
|
mbs.param[3] = DMA_LSW(fcp->isp_scdma);
|
|
|
|
mbs.param[6] = 0;
|
|
|
|
mbs.param[7] = 0;
|
|
|
|
MemoryBarrier();
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
|
|
|
return (-1);
|
|
|
|
}
|
1999-10-17 18:58:22 +00:00
|
|
|
ISP_UNSWIZZLE_SNS_RSP(isp, resp, SNS_GAN_RESP_SIZE >> 1);
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
portid = (((u_int32_t) resp->snscb_port_id[0]) << 16) |
|
|
|
|
(((u_int32_t) resp->snscb_port_id[1]) << 8) |
|
|
|
|
(((u_int32_t) resp->snscb_port_id[2]));
|
|
|
|
if (isp_async(isp, ISPASYNC_FABRIC_DEV, resp)) {
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
if (first_nz_portid == 0 && portid) {
|
|
|
|
first_nz_portid = portid;
|
|
|
|
}
|
|
|
|
if (first_nz_portid == portid) {
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* We either have a broken name server or a huge fabric if we get here.
|
|
|
|
*/
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
#endif
|
1998-04-22 17:54:58 +00:00
|
|
|
/*
|
1998-09-15 08:42:56 +00:00
|
|
|
* Start a command. Locking is assumed done in the caller.
|
1998-04-22 17:54:58 +00:00
|
|
|
*/
|
1998-09-15 08:42:56 +00:00
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
int32_t
|
|
|
|
ispscsicmd(xs)
|
|
|
|
ISP_SCSI_XFER_T *xs;
|
|
|
|
{
|
|
|
|
struct ispsoftc *isp;
|
1999-11-21 03:18:22 +00:00
|
|
|
u_int16_t iptr, optr;
|
1998-04-22 17:54:58 +00:00
|
|
|
union {
|
|
|
|
ispreq_t *_reqp;
|
|
|
|
ispreqt2_t *_t2reqp;
|
|
|
|
} _u;
|
|
|
|
#define reqp _u._reqp
|
|
|
|
#define t2reqp _u._t2reqp
|
|
|
|
#define UZSIZE max(sizeof (ispreq_t), sizeof (ispreqt2_t))
|
1999-10-17 18:58:22 +00:00
|
|
|
int target, i;
|
1998-04-22 17:54:58 +00:00
|
|
|
|
|
|
|
XS_INITERR(xs);
|
|
|
|
isp = XS_ISP(xs);
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
if (isp->isp_state != ISP_RUNSTATE) {
|
|
|
|
PRINTF("%s: adapter not ready\n", isp->isp_name);
|
|
|
|
XS_SETERR(xs, HBA_BOTCH);
|
|
|
|
return (CMD_COMPLETE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1999-03-17 05:04:39 +00:00
|
|
|
* We *could* do the different sequence type that has close
|
1999-03-25 22:52:45 +00:00
|
|
|
* to the whole Queue Entry for the command...
|
1998-09-15 08:42:56 +00:00
|
|
|
*/
|
1999-03-17 05:04:39 +00:00
|
|
|
|
1999-05-11 05:06:55 +00:00
|
|
|
if (XS_CDBLEN(xs) > (IS_FC(isp) ? 16 : 12) || XS_CDBLEN(xs) == 0) {
|
|
|
|
PRINTF("%s: unsupported cdb length (%d, CDB[0]=0x%x)\n",
|
|
|
|
isp->isp_name, XS_CDBLEN(xs), XS_CDBP(xs)[0]);
|
1998-09-15 08:42:56 +00:00
|
|
|
XS_SETERR(xs, HBA_BOTCH);
|
|
|
|
return (CMD_COMPLETE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1999-03-17 05:04:39 +00:00
|
|
|
* Check to see whether we have good firmware state still or
|
|
|
|
* need to refresh our port database for this target.
|
|
|
|
*/
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
target = XS_TGT(xs);
|
1999-03-17 05:04:39 +00:00
|
|
|
if (IS_FC(isp)) {
|
|
|
|
fcparam *fcp = isp->isp_param;
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
struct lportdb *lp;
|
|
|
|
#if defined(ISP2100_FABRIC)
|
|
|
|
if (target >= FL_PORT_ID) {
|
|
|
|
/*
|
|
|
|
* If we're not on a Fabric, we can't have a target
|
|
|
|
* above FL_PORT_ID-1. If we're on a fabric, we
|
|
|
|
* can't have a target less than FC_SNS_ID+1.
|
|
|
|
*/
|
|
|
|
if (fcp->isp_onfabric == 0 || target <= FC_SNS_ID) {
|
|
|
|
XS_SETERR(xs, HBA_SELTIMEOUT);
|
|
|
|
return (CMD_COMPLETE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
1999-03-17 05:04:39 +00:00
|
|
|
/*
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
* Check for f/w being in ready state. If the f/w
|
|
|
|
* isn't in ready state, then we don't know our
|
|
|
|
* loop ID and the f/w hasn't completed logging
|
|
|
|
* into all targets on the loop. If this is the
|
|
|
|
* case, then bounce the command. We pretend this is
|
|
|
|
* a SELECTION TIMEOUT error if we've never gone to
|
|
|
|
* FW_READY state at all- in this case we may not
|
|
|
|
* be hooked to a loop at all and we shouldn't hang
|
|
|
|
* the machine for this. Otherwise, defer this command
|
|
|
|
* until later.
|
1999-03-17 05:04:39 +00:00
|
|
|
*/
|
|
|
|
if (fcp->isp_fwstate != FW_READY) {
|
1999-03-25 22:52:45 +00:00
|
|
|
if (isp_fclink_test(isp, FC_FW_READY_DELAY)) {
|
1999-03-17 05:04:39 +00:00
|
|
|
XS_SETERR(xs, HBA_SELTIMEOUT);
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
if (fcp->loop_seen_once) {
|
1999-08-16 19:59:55 +00:00
|
|
|
return (CMD_RQLATER);
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
} else {
|
|
|
|
return (CMD_COMPLETE);
|
|
|
|
}
|
1999-03-17 05:04:39 +00:00
|
|
|
}
|
|
|
|
}
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If our loop state is such that we haven't yet received
|
|
|
|
* a "Port Database Changed" notification (after a LIP or
|
|
|
|
* a Loop Reset or firmware initialization), then defer
|
2000-01-03 23:52:41 +00:00
|
|
|
* sending commands for a little while, but only if we've
|
|
|
|
* seen a valid loop at one point (otherwise we can get
|
|
|
|
* stuck at initialization time).
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
*/
|
|
|
|
if (fcp->isp_loopstate < LOOP_PDB_RCVD) {
|
|
|
|
XS_SETERR(xs, HBA_SELTIMEOUT);
|
2000-01-03 23:52:41 +00:00
|
|
|
if (fcp->loop_seen_once) {
|
|
|
|
return (CMD_RQLATER);
|
|
|
|
} else {
|
|
|
|
return (CMD_COMPLETE);
|
|
|
|
}
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
}
|
|
|
|
|
1999-03-17 05:04:39 +00:00
|
|
|
/*
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
* If our loop state is now such that we've just now
|
|
|
|
* received a Port Database Change notification, then
|
1999-11-21 03:18:22 +00:00
|
|
|
* we have to go off and (re)synchronize our port
|
|
|
|
* database.
|
1999-03-17 05:04:39 +00:00
|
|
|
*/
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
if (fcp->isp_loopstate == LOOP_PDB_RCVD) {
|
|
|
|
if (isp_pdb_sync(isp, target)) {
|
|
|
|
XS_SETERR(xs, HBA_SELTIMEOUT);
|
|
|
|
return (CMD_COMPLETE);
|
1999-03-17 05:04:39 +00:00
|
|
|
}
|
|
|
|
}
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Now check whether we should even think about pursuing this.
|
|
|
|
*/
|
|
|
|
lp = &fcp->portdb[target];
|
|
|
|
if (lp->valid == 0) {
|
|
|
|
XS_SETERR(xs, HBA_SELTIMEOUT);
|
|
|
|
return (CMD_COMPLETE);
|
|
|
|
}
|
|
|
|
if ((lp->roles & (SVC3_TGT_ROLE >> SVC3_ROLE_SHIFT)) == 0) {
|
1999-08-16 19:59:55 +00:00
|
|
|
IDPRINTF(3, ("%s: target %d is not a target\n",
|
|
|
|
isp->isp_name, target));
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
XS_SETERR(xs, HBA_SELTIMEOUT);
|
|
|
|
return (CMD_COMPLETE);
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Now turn target into what the actual loop ID is.
|
|
|
|
*/
|
|
|
|
target = lp->loopid;
|
1999-03-17 05:04:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Next check to see if any HBA or Device
|
1998-09-15 08:42:56 +00:00
|
|
|
* parameters need to be updated.
|
|
|
|
*/
|
1999-05-11 05:06:55 +00:00
|
|
|
if (isp->isp_update != 0) {
|
1998-09-15 08:42:56 +00:00
|
|
|
isp_update(isp);
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
1998-09-15 08:42:56 +00:00
|
|
|
|
1999-11-21 03:18:22 +00:00
|
|
|
if (isp_getrqentry(isp, &iptr, &optr, (void **) &reqp)) {
|
|
|
|
IDPRINTF(1, ("%s: Request Queue Overflow\n", isp->isp_name));
|
1998-04-22 17:54:58 +00:00
|
|
|
XS_SETERR(xs, HBA_BOTCH);
|
|
|
|
return (CMD_EAGAIN);
|
|
|
|
}
|
|
|
|
|
1999-05-11 05:06:55 +00:00
|
|
|
/*
|
|
|
|
* Now see if we need to synchronize the ISP with respect to anything.
|
|
|
|
* We do dual duty here (cough) for synchronizing for busses other
|
|
|
|
* than which we got here to send a command to.
|
|
|
|
*/
|
1998-04-22 17:54:58 +00:00
|
|
|
if (isp->isp_sendmarker) {
|
1999-12-16 05:42:02 +00:00
|
|
|
u_int8_t n = (IS_DUALBUS(isp)? 2: 1);
|
1998-09-17 21:03:45 +00:00
|
|
|
/*
|
1999-05-11 05:06:55 +00:00
|
|
|
* Check ports to send markers for...
|
1998-09-17 21:03:45 +00:00
|
|
|
*/
|
1999-05-11 05:06:55 +00:00
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
if ((isp->isp_sendmarker & (1 << i)) == 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
MEMZERO((void *) reqp, sizeof (*reqp));
|
|
|
|
reqp->req_header.rqs_entry_count = 1;
|
|
|
|
reqp->req_header.rqs_entry_type = RQSTYPE_MARKER;
|
|
|
|
reqp->req_modifier = SYNC_ALL;
|
1999-10-17 18:58:22 +00:00
|
|
|
reqp->req_target = i << 7; /* insert bus number */
|
|
|
|
ISP_SWIZZLE_REQUEST(isp, reqp);
|
1999-11-21 03:18:22 +00:00
|
|
|
MemoryBarrier();
|
|
|
|
ISP_ADD_REQUEST(isp, iptr);
|
1998-09-17 21:03:45 +00:00
|
|
|
|
1999-11-21 03:18:22 +00:00
|
|
|
if (isp_getrqentry(isp, &iptr, &optr, (void **)&reqp)) {
|
|
|
|
IDPRINTF(1, ("%s: Request Queue Overflow+\n",
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_name));
|
|
|
|
XS_SETERR(xs, HBA_BOTCH);
|
|
|
|
return (CMD_EAGAIN);
|
|
|
|
}
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-01-10 02:55:10 +00:00
|
|
|
MEMZERO((void *) reqp, UZSIZE);
|
1998-04-22 17:54:58 +00:00
|
|
|
reqp->req_header.rqs_entry_count = 1;
|
1999-08-16 19:59:55 +00:00
|
|
|
if (IS_FC(isp)) {
|
1998-04-22 17:54:58 +00:00
|
|
|
reqp->req_header.rqs_entry_type = RQSTYPE_T2RQS;
|
|
|
|
} else {
|
|
|
|
reqp->req_header.rqs_entry_type = RQSTYPE_REQUEST;
|
|
|
|
}
|
|
|
|
reqp->req_header.rqs_flags = 0;
|
1999-10-17 18:58:22 +00:00
|
|
|
reqp->req_header.rqs_seqno = 0;
|
1999-08-16 19:59:55 +00:00
|
|
|
if (IS_FC(isp)) {
|
1998-04-22 17:54:58 +00:00
|
|
|
/*
|
|
|
|
* See comment in isp_intr
|
|
|
|
*/
|
|
|
|
XS_RESID(xs) = 0;
|
1999-03-25 22:52:45 +00:00
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
/*
|
1999-10-28 02:48:42 +00:00
|
|
|
* Fibre Channel always requires some kind of tag.
|
|
|
|
* The Qlogic drivers seem be happy not to use a tag,
|
|
|
|
* but this breaks for some devices (IBM drives).
|
1998-04-22 17:54:58 +00:00
|
|
|
*/
|
1998-09-15 08:42:56 +00:00
|
|
|
if (XS_CANTAG(xs)) {
|
|
|
|
t2reqp->req_flags = XS_KINDOF_TAG(xs);
|
1999-10-28 02:48:42 +00:00
|
|
|
} else {
|
|
|
|
if (XS_CDBP(xs)[0] == 0x3) /* REQUEST SENSE */
|
|
|
|
t2reqp->req_flags = REQFLAG_HTAG;
|
|
|
|
else
|
|
|
|
t2reqp->req_flags = REQFLAG_OTAG;
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
sdparam *sdp = (sdparam *)isp->isp_param;
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
if ((sdp->isp_devparam[target].cur_dflags & DPARM_TQING) &&
|
1998-09-15 08:42:56 +00:00
|
|
|
XS_CANTAG(xs)) {
|
|
|
|
reqp->req_flags = XS_KINDOF_TAG(xs);
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
}
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
reqp->req_target = target | (XS_CHANNEL(xs) << 7);
|
1999-08-16 19:59:55 +00:00
|
|
|
if (IS_SCSI(isp)) {
|
1998-12-05 01:33:57 +00:00
|
|
|
reqp->req_lun_trn = XS_LUN(xs);
|
1998-04-22 17:54:58 +00:00
|
|
|
reqp->req_cdblen = XS_CDBLEN(xs);
|
1998-12-05 01:33:57 +00:00
|
|
|
} else {
|
1999-03-17 05:04:39 +00:00
|
|
|
#ifdef ISP2100_SCCLUN
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
t2reqp->req_scclun = XS_LUN(xs);
|
1998-12-05 01:33:57 +00:00
|
|
|
#else
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
t2reqp->req_lun_trn = XS_LUN(xs);
|
1998-12-05 01:33:57 +00:00
|
|
|
#endif
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
1999-01-10 11:15:23 +00:00
|
|
|
MEMCPY(reqp->req_cdb, XS_CDBP(xs), XS_CDBLEN(xs));
|
1998-04-22 17:54:58 +00:00
|
|
|
|
|
|
|
reqp->req_time = XS_TIME(xs) / 1000;
|
|
|
|
if (reqp->req_time == 0 && XS_TIME(xs))
|
|
|
|
reqp->req_time = 1;
|
1999-03-17 05:04:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Always give a bit more leeway to commands after a bus reset.
|
1999-05-11 05:06:55 +00:00
|
|
|
* XXX: DOES NOT DISTINGUISH WHICH PORT MAY HAVE BEEN SYNCED
|
1999-03-17 05:04:39 +00:00
|
|
|
*/
|
1999-10-17 18:58:22 +00:00
|
|
|
if (isp->isp_sendmarker && reqp->req_time < 5) {
|
1999-03-17 05:04:39 +00:00
|
|
|
reqp->req_time = 5;
|
1999-10-17 18:58:22 +00:00
|
|
|
}
|
|
|
|
if (isp_save_xs(isp, xs, &reqp->req_handle)) {
|
|
|
|
IDPRINTF(2, ("%s: out of xflist pointers\n", isp->isp_name));
|
|
|
|
XS_SETERR(xs, HBA_BOTCH);
|
|
|
|
return (CMD_EAGAIN);
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Set up DMA and/or do any bus swizzling of the request entry
|
|
|
|
* so that the Qlogic F/W understands what is being asked of it.
|
|
|
|
*/
|
1998-09-17 21:03:45 +00:00
|
|
|
i = ISP_DMASETUP(isp, xs, reqp, &iptr, optr);
|
|
|
|
if (i != CMD_QUEUED) {
|
1999-10-17 18:58:22 +00:00
|
|
|
isp_destroy_handle(isp, reqp->req_handle);
|
1998-09-17 21:03:45 +00:00
|
|
|
/*
|
|
|
|
* dmasetup sets actual error in packet, and
|
|
|
|
* return what we were given to return.
|
|
|
|
*/
|
|
|
|
return (i);
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
XS_SETERR(xs, HBA_NOERROR);
|
1999-10-17 18:58:22 +00:00
|
|
|
IDPRINTF(5, ("%s(%d.%d.%d): START cmd 0x%x datalen %d\n",
|
|
|
|
isp->isp_name, XS_CHANNEL(xs), target, XS_LUN(xs),
|
|
|
|
reqp->req_cdb[0], XS_XFRLEN(xs)));
|
1999-03-17 05:04:39 +00:00
|
|
|
MemoryBarrier();
|
1999-11-21 03:18:22 +00:00
|
|
|
ISP_ADD_REQUEST(isp, iptr);
|
1998-09-15 08:42:56 +00:00
|
|
|
isp->isp_nactive++;
|
1999-03-17 05:04:39 +00:00
|
|
|
if (isp->isp_sendmarker)
|
|
|
|
isp->isp_sendmarker = 0;
|
1998-09-15 08:42:56 +00:00
|
|
|
return (CMD_QUEUED);
|
1998-04-22 17:54:58 +00:00
|
|
|
#undef reqp
|
|
|
|
#undef t2reqp
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1998-09-15 08:42:56 +00:00
|
|
|
* isp control
|
|
|
|
* Locks (ints blocked) assumed held.
|
1998-04-22 17:54:58 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
int
|
1998-09-15 08:42:56 +00:00
|
|
|
isp_control(isp, ctl, arg)
|
1998-04-22 17:54:58 +00:00
|
|
|
struct ispsoftc *isp;
|
1998-09-15 08:42:56 +00:00
|
|
|
ispctl_t ctl;
|
1998-04-22 17:54:58 +00:00
|
|
|
void *arg;
|
|
|
|
{
|
|
|
|
ISP_SCSI_XFER_T *xs;
|
1998-09-15 08:42:56 +00:00
|
|
|
mbreg_t mbs;
|
1999-10-17 18:58:22 +00:00
|
|
|
int bus, tgt;
|
|
|
|
u_int32_t handle;
|
1998-04-22 17:54:58 +00:00
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
switch (ctl) {
|
|
|
|
default:
|
|
|
|
PRINTF("%s: isp_control unknown control op %x\n",
|
|
|
|
isp->isp_name, ctl);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ISPCTL_RESET_BUS:
|
1999-03-17 05:04:39 +00:00
|
|
|
/*
|
|
|
|
* Issue a bus reset.
|
|
|
|
*/
|
1998-09-15 08:42:56 +00:00
|
|
|
mbs.param[0] = MBOX_BUS_RESET;
|
1999-08-16 19:59:55 +00:00
|
|
|
if (IS_SCSI(isp)) {
|
1999-02-09 01:07:06 +00:00
|
|
|
mbs.param[1] =
|
|
|
|
((sdparam *) isp->isp_param)->isp_bus_reset_delay;
|
1999-03-17 05:04:39 +00:00
|
|
|
if (mbs.param[1] < 2)
|
|
|
|
mbs.param[1] = 2;
|
1999-08-16 19:59:55 +00:00
|
|
|
bus = *((int *) arg);
|
|
|
|
mbs.param[2] = bus;
|
1999-02-09 01:07:06 +00:00
|
|
|
} else {
|
1999-08-16 19:59:55 +00:00
|
|
|
mbs.param[1] = 10;
|
1999-10-22 17:03:03 +00:00
|
|
|
mbs.param[2] = 0;
|
1999-08-16 19:59:55 +00:00
|
|
|
bus = 0;
|
1999-02-09 01:07:06 +00:00
|
|
|
}
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_sendmarker = 1 << bus;
|
1998-09-15 08:42:56 +00:00
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
|
|
|
isp_dumpregs(isp, "isp_control SCSI bus reset failed");
|
|
|
|
break;
|
|
|
|
}
|
1999-12-03 06:55:39 +00:00
|
|
|
CFGPRINTF("%s: driver initiated bus reset of bus %d\n",
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_name, bus);
|
1998-09-15 08:42:56 +00:00
|
|
|
return (0);
|
|
|
|
|
1999-03-25 22:52:45 +00:00
|
|
|
case ISPCTL_RESET_DEV:
|
1999-05-11 05:06:55 +00:00
|
|
|
tgt = (*((int *) arg)) & 0xffff;
|
|
|
|
bus = (*((int *) arg)) >> 16;
|
1998-09-15 08:42:56 +00:00
|
|
|
mbs.param[0] = MBOX_ABORT_TARGET;
|
1999-05-11 05:06:55 +00:00
|
|
|
mbs.param[1] = (tgt << 8) | (bus << 15);
|
1999-02-09 01:07:06 +00:00
|
|
|
mbs.param[2] = 3; /* 'delay', in seconds */
|
1998-09-15 08:42:56 +00:00
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
1999-10-17 18:58:22 +00:00
|
|
|
PRINTF("%s: isp_control MBOX_RESET_DEV failure (code "
|
|
|
|
"%x)\n", isp->isp_name, mbs.param[0]);
|
1998-09-15 08:42:56 +00:00
|
|
|
break;
|
|
|
|
}
|
1999-05-11 05:06:55 +00:00
|
|
|
PRINTF("%s: Target %d on Bus %d Reset Succeeded\n",
|
|
|
|
isp->isp_name, tgt, bus);
|
|
|
|
isp->isp_sendmarker = 1 << bus;
|
1998-09-15 08:42:56 +00:00
|
|
|
return (0);
|
|
|
|
|
1999-03-25 22:52:45 +00:00
|
|
|
case ISPCTL_ABORT_CMD:
|
1998-09-15 08:42:56 +00:00
|
|
|
xs = (ISP_SCSI_XFER_T *) arg;
|
1999-10-17 18:58:22 +00:00
|
|
|
handle = isp_find_handle(isp, xs);
|
|
|
|
if (handle == 0) {
|
1998-09-15 08:42:56 +00:00
|
|
|
PRINTF("%s: isp_control- cannot find command to abort "
|
|
|
|
"in active list\n", isp->isp_name);
|
|
|
|
break;
|
|
|
|
}
|
1999-10-17 18:58:22 +00:00
|
|
|
bus = XS_CHANNEL(xs);
|
1998-09-15 08:42:56 +00:00
|
|
|
mbs.param[0] = MBOX_ABORT;
|
1999-08-16 19:59:55 +00:00
|
|
|
if (IS_FC(isp)) {
|
1999-10-17 18:58:22 +00:00
|
|
|
#ifdef ISP2100_SCCLUN
|
1998-12-05 01:33:57 +00:00
|
|
|
mbs.param[1] = XS_TGT(xs) << 8;
|
|
|
|
mbs.param[4] = 0;
|
|
|
|
mbs.param[5] = 0;
|
|
|
|
mbs.param[6] = XS_LUN(xs);
|
|
|
|
#else
|
1999-10-17 18:58:22 +00:00
|
|
|
mbs.param[1] = XS_TGT(xs) << 8 | XS_LUN(xs);
|
1998-12-05 01:33:57 +00:00
|
|
|
#endif
|
1999-10-17 18:58:22 +00:00
|
|
|
} else {
|
|
|
|
mbs.param[1] =
|
|
|
|
(bus << 15) | (XS_TGT(xs) << 8) | XS_LUN(xs);
|
|
|
|
}
|
|
|
|
mbs.param[2] = handle >> 16;
|
|
|
|
mbs.param[3] = handle & 0xffff;
|
1998-09-15 08:42:56 +00:00
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
|
|
|
PRINTF("%s: isp_control MBOX_ABORT failure (code %x)\n",
|
|
|
|
isp->isp_name, mbs.param[0]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
PRINTF("%s: command for target %d lun %d was aborted\n",
|
|
|
|
isp->isp_name, XS_TGT(xs), XS_LUN(xs));
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
case ISPCTL_UPDATE_PARAMS:
|
|
|
|
isp_update(isp);
|
1999-03-25 22:52:45 +00:00
|
|
|
return (0);
|
1999-03-17 05:04:39 +00:00
|
|
|
|
|
|
|
case ISPCTL_FCLINK_TEST:
|
1999-03-25 22:52:45 +00:00
|
|
|
return (isp_fclink_test(isp, FC_FW_READY_DELAY));
|
1999-11-21 03:18:22 +00:00
|
|
|
|
2000-01-03 23:52:41 +00:00
|
|
|
case ISPCTL_PDB_SYNC:
|
|
|
|
return (isp_pdb_sync(isp, -1));
|
|
|
|
|
|
|
|
#ifdef ISP_TARGET_MODE
|
|
|
|
case ISPCTL_TOGGLE_TMODE:
|
|
|
|
if (IS_SCSI(isp)) {
|
|
|
|
int ena = *(int *)arg;
|
|
|
|
mbs.param[0] = MBOX_ENABLE_TARGET_MODE;
|
|
|
|
mbs.param[1] = (ena)? ENABLE_TARGET_FLAG : 0;
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
|
|
|
PRINTF("%s: cannot %sable target mode (0x%x)\n",
|
|
|
|
isp->isp_name, ena? "en" : "dis",
|
|
|
|
mbs.param[0]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (0);
|
1999-11-21 03:18:22 +00:00
|
|
|
#endif
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Interrupt Service Routine(s).
|
|
|
|
*
|
|
|
|
* External (OS) framework has done the appropriate locking,
|
|
|
|
* and the locking will be held throughout this function.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int
|
|
|
|
isp_intr(arg)
|
|
|
|
void *arg;
|
|
|
|
{
|
|
|
|
ISP_SCSI_XFER_T *complist[RESULT_QUEUE_LEN], *xs;
|
|
|
|
struct ispsoftc *isp = arg;
|
1999-11-21 03:18:22 +00:00
|
|
|
u_int16_t iptr, optr;
|
1999-08-16 19:59:55 +00:00
|
|
|
u_int16_t isr, isrb, sema;
|
1999-02-09 01:07:06 +00:00
|
|
|
int i, nlooked = 0, ndone = 0;
|
1998-09-15 08:42:56 +00:00
|
|
|
|
1999-05-11 05:06:55 +00:00
|
|
|
/*
|
|
|
|
* Well, if we've disabled interrupts, we may get a case where
|
1999-10-17 18:58:22 +00:00
|
|
|
* isr isn't set, but sema is. In any case, debounce isr reads.
|
1999-05-11 05:06:55 +00:00
|
|
|
*/
|
1999-08-16 19:59:55 +00:00
|
|
|
do {
|
|
|
|
isr = ISP_READ(isp, BIU_ISR);
|
|
|
|
isrb = ISP_READ(isp, BIU_ISR);
|
|
|
|
} while (isr != isrb);
|
1999-05-11 05:06:55 +00:00
|
|
|
sema = ISP_READ(isp, BIU_SEMA) & 0x1;
|
|
|
|
IDPRINTF(5, ("%s: isp_intr isr %x sem %x\n", isp->isp_name, isr, sema));
|
1999-10-17 18:58:22 +00:00
|
|
|
if (isr == 0) {
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
if (!INT_PENDING(isp, isr)) {
|
|
|
|
IDPRINTF(4, ("%s: isp_intr isr=%x\n", isp->isp_name, isr));
|
|
|
|
return (0);
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
1999-04-04 02:28:29 +00:00
|
|
|
if (isp->isp_state != ISP_RUNSTATE) {
|
1999-05-11 05:06:55 +00:00
|
|
|
IDPRINTF(3, ("%s: interrupt (isr=%x,sema=%x) when not ready\n",
|
|
|
|
isp->isp_name, isr, sema));
|
1999-04-04 02:28:29 +00:00
|
|
|
ISP_WRITE(isp, INMAILBOX5, ISP_READ(isp, OUTMAILBOX5));
|
|
|
|
ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT);
|
|
|
|
ISP_WRITE(isp, BIU_SEMA, 0);
|
|
|
|
ENABLE_INTS(isp);
|
|
|
|
return (1);
|
|
|
|
}
|
1998-04-22 17:54:58 +00:00
|
|
|
|
1999-05-11 05:06:55 +00:00
|
|
|
if (sema) {
|
1998-09-15 08:42:56 +00:00
|
|
|
u_int16_t mbox = ISP_READ(isp, OUTMAILBOX0);
|
1999-03-17 05:04:39 +00:00
|
|
|
if (mbox & 0x4000) {
|
2000-01-09 21:47:39 +00:00
|
|
|
IDPRINTF(4, ("%s: Command Mbox 0x%x\n",
|
1999-03-25 22:52:45 +00:00
|
|
|
isp->isp_name, mbox));
|
1999-03-17 05:04:39 +00:00
|
|
|
} else {
|
|
|
|
u_int32_t fhandle = isp_parse_async(isp, (int) mbox);
|
2000-01-09 21:47:39 +00:00
|
|
|
IDPRINTF(4, ("%s: Async Mbox 0x%x\n",
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_name, mbox));
|
1999-04-04 02:28:29 +00:00
|
|
|
if (fhandle > 0) {
|
1999-10-17 18:58:22 +00:00
|
|
|
isp_fastpost_complete(isp, fhandle);
|
1999-01-30 07:29:00 +00:00
|
|
|
}
|
|
|
|
}
|
1999-04-04 02:28:29 +00:00
|
|
|
ISP_WRITE(isp, BIU_SEMA, 0);
|
|
|
|
ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT);
|
|
|
|
ENABLE_INTS(isp);
|
|
|
|
return (1);
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
1998-09-15 08:42:56 +00:00
|
|
|
|
1999-04-04 02:28:29 +00:00
|
|
|
/*
|
|
|
|
* You *must* read OUTMAILBOX5 prior to clearing the RISC interrupt.
|
|
|
|
*/
|
1998-09-15 08:42:56 +00:00
|
|
|
optr = isp->isp_residx;
|
1998-04-22 17:54:58 +00:00
|
|
|
iptr = ISP_READ(isp, OUTMAILBOX5);
|
1999-04-04 02:28:29 +00:00
|
|
|
ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT);
|
1998-04-22 17:54:58 +00:00
|
|
|
if (optr == iptr) {
|
|
|
|
IDPRINTF(4, ("why intr? isr %x iptr %x optr %x\n",
|
1998-09-15 08:42:56 +00:00
|
|
|
isr, optr, iptr));
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
while (optr != iptr) {
|
|
|
|
ispstatusreq_t *sp;
|
1999-11-21 03:18:22 +00:00
|
|
|
u_int16_t oop;
|
1998-04-22 17:54:58 +00:00
|
|
|
int buddaboom = 0;
|
|
|
|
|
|
|
|
sp = (ispstatusreq_t *) ISP_QUEUE_ENTRY(isp->isp_result, optr);
|
1998-09-15 08:42:56 +00:00
|
|
|
oop = optr;
|
|
|
|
optr = ISP_NXT_QENTRY(optr, RESULT_QUEUE_LEN);
|
1999-02-09 01:07:06 +00:00
|
|
|
nlooked++;
|
1999-03-17 05:04:39 +00:00
|
|
|
MemoryBarrier();
|
1999-10-17 18:58:22 +00:00
|
|
|
/*
|
|
|
|
* Do any appropriate unswizzling of what the Qlogic f/w has
|
2000-01-03 23:52:41 +00:00
|
|
|
* written into memory so it makes sense to us. This is a
|
|
|
|
* per-platform thing.
|
1999-10-17 18:58:22 +00:00
|
|
|
*/
|
|
|
|
ISP_UNSWIZZLE_RESPONSE(isp, sp);
|
1998-04-22 17:54:58 +00:00
|
|
|
if (sp->req_header.rqs_entry_type != RQSTYPE_RESPONSE) {
|
1998-09-15 08:42:56 +00:00
|
|
|
if (isp_handle_other_response(isp, sp, &optr) == 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* It really has to be a bounced request just copied
|
1999-04-14 17:37:36 +00:00
|
|
|
* from the request queue to the response queue. If
|
|
|
|
* not, something bad has happened.
|
1998-09-15 08:42:56 +00:00
|
|
|
*/
|
1998-04-22 17:54:58 +00:00
|
|
|
if (sp->req_header.rqs_entry_type != RQSTYPE_REQUEST) {
|
1999-04-14 17:37:36 +00:00
|
|
|
PRINTF("%s: not RESPONSE in RESPONSE Queue "
|
|
|
|
"(type 0x%x) @ idx %d (next %d)\n",
|
|
|
|
isp->isp_name,
|
|
|
|
sp->req_header.rqs_entry_type, oop, optr);
|
1998-04-22 17:54:58 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
buddaboom = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sp->req_header.rqs_flags & 0xf) {
|
1999-04-14 17:37:36 +00:00
|
|
|
#define _RQS_OFLAGS \
|
|
|
|
~(RQSFLAG_CONTINUATION|RQSFLAG_FULL|RQSFLAG_BADHEADER|RQSFLAG_BADPACKET)
|
1998-04-22 17:54:58 +00:00
|
|
|
if (sp->req_header.rqs_flags & RQSFLAG_CONTINUATION) {
|
2000-01-09 21:47:39 +00:00
|
|
|
IDPRINTF(4, ("%s: continuation segment\n",
|
1999-04-14 17:37:36 +00:00
|
|
|
isp->isp_name));
|
1998-04-22 17:54:58 +00:00
|
|
|
ISP_WRITE(isp, INMAILBOX5, optr);
|
|
|
|
continue;
|
|
|
|
}
|
1998-09-15 08:42:56 +00:00
|
|
|
if (sp->req_header.rqs_flags & RQSFLAG_FULL) {
|
1999-04-14 17:37:36 +00:00
|
|
|
IDPRINTF(2, ("%s: internal queues full\n",
|
|
|
|
isp->isp_name));
|
|
|
|
/*
|
|
|
|
* We'll synthesize a QUEUE FULL message below.
|
|
|
|
*/
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
|
|
|
if (sp->req_header.rqs_flags & RQSFLAG_BADHEADER) {
|
|
|
|
PRINTF("%s: bad header\n", isp->isp_name);
|
|
|
|
buddaboom++;
|
|
|
|
}
|
|
|
|
if (sp->req_header.rqs_flags & RQSFLAG_BADPACKET) {
|
|
|
|
PRINTF("%s: bad request packet\n",
|
|
|
|
isp->isp_name);
|
|
|
|
buddaboom++;
|
|
|
|
}
|
1999-04-14 17:37:36 +00:00
|
|
|
if (sp->req_header.rqs_flags & _RQS_OFLAGS) {
|
|
|
|
PRINTF("%s: unknown flags in response (0x%x)\n",
|
|
|
|
isp->isp_name, sp->req_header.rqs_flags);
|
|
|
|
buddaboom++;
|
|
|
|
}
|
|
|
|
#undef _RQS_OFLAGS
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
1999-10-17 18:58:22 +00:00
|
|
|
if (sp->req_handle > isp->isp_maxcmds || sp->req_handle < 1) {
|
1998-04-22 17:54:58 +00:00
|
|
|
PRINTF("%s: bad request handle %d\n", isp->isp_name,
|
1999-10-17 18:58:22 +00:00
|
|
|
sp->req_handle);
|
1998-04-22 17:54:58 +00:00
|
|
|
ISP_WRITE(isp, INMAILBOX5, optr);
|
|
|
|
continue;
|
|
|
|
}
|
1999-10-17 18:58:22 +00:00
|
|
|
xs = isp_find_xs(isp, sp->req_handle);
|
1998-04-22 17:54:58 +00:00
|
|
|
if (xs == NULL) {
|
1999-10-17 18:58:22 +00:00
|
|
|
PRINTF("%s: NULL xs in xflist (handle 0x%x)\n",
|
1998-09-15 08:42:56 +00:00
|
|
|
isp->isp_name, sp->req_handle);
|
1998-04-22 17:54:58 +00:00
|
|
|
ISP_WRITE(isp, INMAILBOX5, optr);
|
|
|
|
continue;
|
|
|
|
}
|
1999-10-17 18:58:22 +00:00
|
|
|
isp_destroy_handle(isp, sp->req_handle);
|
1998-04-22 17:54:58 +00:00
|
|
|
if (sp->req_status_flags & RQSTF_BUS_RESET) {
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_sendmarker |= (1 << XS_CHANNEL(xs));
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
if (buddaboom) {
|
|
|
|
XS_SETERR(xs, HBA_BOTCH);
|
|
|
|
}
|
|
|
|
XS_STS(xs) = sp->req_scsi_status & 0xff;
|
1999-05-11 05:06:55 +00:00
|
|
|
if (IS_SCSI(isp)) {
|
1998-04-22 17:54:58 +00:00
|
|
|
if (sp->req_state_flags & RQSF_GOT_SENSE) {
|
1999-01-10 11:15:23 +00:00
|
|
|
MEMCPY(XS_SNSP(xs), sp->req_sense_data,
|
1998-04-22 17:54:58 +00:00
|
|
|
XS_SNSLEN(xs));
|
|
|
|
XS_SNS_IS_VALID(xs);
|
|
|
|
}
|
1999-01-30 07:29:00 +00:00
|
|
|
/*
|
|
|
|
* A new synchronous rate was negotiated for this
|
|
|
|
* target. Mark state such that we'll go look up
|
|
|
|
* that which has changed later.
|
|
|
|
*/
|
|
|
|
if (sp->req_status_flags & RQSTF_NEGOTIATION) {
|
|
|
|
sdparam *sdp = isp->isp_param;
|
1999-05-11 05:06:55 +00:00
|
|
|
sdp += XS_CHANNEL(xs);
|
1999-01-30 07:29:00 +00:00
|
|
|
sdp->isp_devparam[XS_TGT(xs)].dev_refresh = 1;
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_update |= (1 << XS_CHANNEL(xs));
|
1999-04-14 17:37:36 +00:00
|
|
|
}
|
1998-04-22 17:54:58 +00:00
|
|
|
} else {
|
2000-01-04 03:44:21 +00:00
|
|
|
if (sp->req_scsi_status & RQCS_SV) {
|
|
|
|
int amt = min(XS_SNSLEN(xs), sp->req_sense_len);
|
|
|
|
MEMCPY(XS_SNSP(xs), sp->req_sense_data, amt);
|
1998-04-22 17:54:58 +00:00
|
|
|
XS_SNS_IS_VALID(xs);
|
|
|
|
sp->req_state_flags |= RQSF_GOT_SENSE;
|
2000-01-04 03:44:21 +00:00
|
|
|
} else if (XS_STS(xs) == SCSI_CHECK) {
|
|
|
|
IDPRINTF(1, ("%s: check condition with no sense"
|
|
|
|
" data\n", isp->isp_name));
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (XS_NOERR(xs) && XS_STS(xs) == SCSI_BUSY) {
|
|
|
|
XS_SETERR(xs, HBA_TGTBSY);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sp->req_header.rqs_entry_type == RQSTYPE_RESPONSE) {
|
1998-09-15 08:42:56 +00:00
|
|
|
if (XS_NOERR(xs)) {
|
|
|
|
if (sp->req_completion_status != RQCS_COMPLETE) {
|
1998-04-22 17:54:58 +00:00
|
|
|
isp_parse_status(isp, sp, xs);
|
1998-09-15 08:42:56 +00:00
|
|
|
} else {
|
|
|
|
XS_SETERR(xs, HBA_NOERROR);
|
|
|
|
}
|
|
|
|
}
|
1999-05-11 05:06:55 +00:00
|
|
|
} else if (sp->req_header.rqs_entry_type == RQSTYPE_REQUEST) {
|
|
|
|
if (sp->req_header.rqs_flags & RQSFLAG_FULL) {
|
|
|
|
/*
|
|
|
|
* Force Queue Full status.
|
|
|
|
*/
|
|
|
|
XS_STS(xs) = SCSI_QFULL;
|
|
|
|
XS_SETERR(xs, HBA_NOERROR);
|
|
|
|
} else if (XS_NOERR(xs)) {
|
|
|
|
XS_SETERR(xs, HBA_BOTCH);
|
|
|
|
}
|
1998-04-22 17:54:58 +00:00
|
|
|
} else {
|
1999-05-11 05:06:55 +00:00
|
|
|
PRINTF("%s: unhandled respose queue type 0x%x\n",
|
|
|
|
isp->isp_name, sp->req_header.rqs_entry_type);
|
1999-01-10 02:55:10 +00:00
|
|
|
if (XS_NOERR(xs)) {
|
1998-04-22 17:54:58 +00:00
|
|
|
XS_SETERR(xs, HBA_BOTCH);
|
1999-01-10 02:55:10 +00:00
|
|
|
}
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
1999-08-16 19:59:55 +00:00
|
|
|
if (IS_SCSI(isp)) {
|
1998-04-22 17:54:58 +00:00
|
|
|
XS_RESID(xs) = sp->req_resid;
|
|
|
|
} else if (sp->req_scsi_status & RQCS_RU) {
|
|
|
|
XS_RESID(xs) = sp->req_resid;
|
|
|
|
IDPRINTF(4, ("%s: cnt %d rsd %d\n", isp->isp_name,
|
|
|
|
XS_XFRLEN(xs), sp->req_resid));
|
|
|
|
}
|
|
|
|
if (XS_XFRLEN(xs)) {
|
1999-10-17 18:58:22 +00:00
|
|
|
ISP_DMAFREE(isp, xs, sp->req_handle);
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
2000-01-04 03:44:21 +00:00
|
|
|
/*
|
|
|
|
* Let the platforms cope.
|
|
|
|
*/
|
|
|
|
#if 0
|
1998-09-15 08:42:56 +00:00
|
|
|
/*
|
|
|
|
* XXX: If we have a check condition, but no Sense Data,
|
|
|
|
* XXX: mark it as an error (ARQ failed). We need to
|
|
|
|
* XXX: to do a more distinct job because there may
|
|
|
|
* XXX: cases where ARQ is disabled.
|
|
|
|
*/
|
|
|
|
if (XS_STS(xs) == SCSI_CHECK && !(XS_IS_SNS_VALID(xs))) {
|
|
|
|
if (XS_NOERR(xs)) {
|
1998-12-05 01:33:57 +00:00
|
|
|
PRINTF("%s: ARQ failure for target %d lun %d\n",
|
|
|
|
isp->isp_name, XS_TGT(xs), XS_LUN(xs));
|
1998-09-15 08:42:56 +00:00
|
|
|
XS_SETERR(xs, HBA_ARQFAIL);
|
|
|
|
}
|
|
|
|
}
|
2000-01-04 03:44:21 +00:00
|
|
|
#endif
|
1998-04-22 17:54:58 +00:00
|
|
|
if ((isp->isp_dblev >= 5) ||
|
|
|
|
(isp->isp_dblev > 2 && !XS_NOERR(xs))) {
|
1999-10-17 18:58:22 +00:00
|
|
|
PRINTF("%s(%d.%d): FIN dl%d resid%d STS %x",
|
1998-04-22 17:54:58 +00:00
|
|
|
isp->isp_name, XS_TGT(xs), XS_LUN(xs),
|
1999-10-17 18:58:22 +00:00
|
|
|
XS_XFRLEN(xs), XS_RESID(xs), XS_STS(xs));
|
1998-04-22 17:54:58 +00:00
|
|
|
if (sp->req_state_flags & RQSF_GOT_SENSE) {
|
|
|
|
PRINTF(" Skey: %x", XS_SNSKEY(xs));
|
|
|
|
if (!(XS_IS_SNS_VALID(xs))) {
|
|
|
|
PRINTF(" BUT NOT SET");
|
|
|
|
}
|
|
|
|
}
|
1998-09-15 22:44:51 +00:00
|
|
|
PRINTF(" XS_ERR=0x%x\n", (unsigned int) XS_ERR(xs));
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
1998-09-15 08:42:56 +00:00
|
|
|
|
1998-12-05 01:33:57 +00:00
|
|
|
if (isp->isp_nactive > 0)
|
|
|
|
isp->isp_nactive--;
|
1998-09-15 08:42:56 +00:00
|
|
|
complist[ndone++] = xs; /* defer completion call until later */
|
|
|
|
}
|
1999-02-09 01:07:06 +00:00
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
/*
|
1999-02-09 01:07:06 +00:00
|
|
|
* If we looked at any commands, then it's valid to find out
|
|
|
|
* what the outpointer is. It also is a trigger to update the
|
|
|
|
* ISP's notion of what we've seen so far.
|
1998-09-15 08:42:56 +00:00
|
|
|
*/
|
1999-03-17 05:04:39 +00:00
|
|
|
if (nlooked) {
|
1999-02-09 01:07:06 +00:00
|
|
|
ISP_WRITE(isp, INMAILBOX5, optr);
|
1999-03-25 22:52:45 +00:00
|
|
|
isp->isp_reqodx = ISP_READ(isp, OUTMAILBOX4);
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
isp->isp_residx = optr;
|
1998-09-15 08:42:56 +00:00
|
|
|
for (i = 0; i < ndone; i++) {
|
|
|
|
xs = complist[i];
|
|
|
|
if (xs) {
|
|
|
|
XS_CMD_DONE(xs);
|
|
|
|
}
|
|
|
|
}
|
1999-04-04 02:28:29 +00:00
|
|
|
ENABLE_INTS(isp);
|
1998-04-22 17:54:58 +00:00
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Support routines.
|
|
|
|
*/
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
static int
|
|
|
|
isp_parse_async(isp, mbox)
|
|
|
|
struct ispsoftc *isp;
|
1998-12-05 01:33:57 +00:00
|
|
|
int mbox;
|
1998-09-15 08:42:56 +00:00
|
|
|
{
|
1999-11-21 03:18:22 +00:00
|
|
|
int bus;
|
1999-01-30 07:29:00 +00:00
|
|
|
u_int32_t fast_post_handle = 0;
|
|
|
|
|
1999-12-16 05:42:02 +00:00
|
|
|
if (IS_DUALBUS(isp)) {
|
1999-11-21 03:18:22 +00:00
|
|
|
bus = ISP_READ(isp, OUTMAILBOX6);
|
|
|
|
} else {
|
|
|
|
bus = 0;
|
|
|
|
}
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
switch (mbox) {
|
1999-03-17 05:04:39 +00:00
|
|
|
case MBOX_COMMAND_COMPLETE: /* sometimes these show up */
|
|
|
|
break;
|
1998-09-15 08:42:56 +00:00
|
|
|
case ASYNC_BUS_RESET:
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_sendmarker = (1 << bus);
|
1998-12-05 01:33:57 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
2000-01-03 23:52:41 +00:00
|
|
|
isp_target_async(isp, bus, mbox);
|
1998-12-05 01:33:57 +00:00
|
|
|
#endif
|
1999-11-21 03:18:22 +00:00
|
|
|
isp_async(isp, ISPASYNC_BUS_RESET, &bus);
|
1998-09-15 08:42:56 +00:00
|
|
|
break;
|
|
|
|
case ASYNC_SYSTEM_ERROR:
|
|
|
|
mbox = ISP_READ(isp, OUTMAILBOX1);
|
|
|
|
PRINTF("%s: Internal FW Error @ RISC Addr 0x%x\n",
|
|
|
|
isp->isp_name, mbox);
|
|
|
|
isp_restart(isp);
|
|
|
|
/* no point continuing after this */
|
1999-01-30 07:29:00 +00:00
|
|
|
return (-1);
|
1998-09-15 08:42:56 +00:00
|
|
|
|
|
|
|
case ASYNC_RQS_XFER_ERR:
|
|
|
|
PRINTF("%s: Request Queue Transfer Error\n", isp->isp_name);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ASYNC_RSP_XFER_ERR:
|
|
|
|
PRINTF("%s: Response Queue Transfer Error\n", isp->isp_name);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ASYNC_QWAKEUP:
|
1999-11-21 03:18:22 +00:00
|
|
|
/*
|
|
|
|
* We've just been notified that the Queue has woken up.
|
|
|
|
* We don't need to be chatty about this- just unlatch things
|
|
|
|
* and move on.
|
|
|
|
*/
|
1998-09-15 08:42:56 +00:00
|
|
|
mbox = ISP_READ(isp, OUTMAILBOX4);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ASYNC_TIMEOUT_RESET:
|
1999-11-21 03:18:22 +00:00
|
|
|
PRINTF("%s: timeout initiated SCSI bus reset of bus %d\n",
|
|
|
|
isp->isp_name, bus);
|
|
|
|
isp->isp_sendmarker = (1 << bus);
|
1998-12-05 01:33:57 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
2000-01-03 23:52:41 +00:00
|
|
|
isp_target_async(isp, bus, mbox);
|
1998-12-05 01:33:57 +00:00
|
|
|
#endif
|
1998-09-15 08:42:56 +00:00
|
|
|
break;
|
|
|
|
|
1998-12-05 01:33:57 +00:00
|
|
|
case ASYNC_DEVICE_RESET:
|
1999-11-21 03:18:22 +00:00
|
|
|
PRINTF("%s: device reset on bus %d\n", isp->isp_name, bus);
|
|
|
|
isp->isp_sendmarker = 1 << bus;
|
1998-12-05 01:33:57 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
2000-01-03 23:52:41 +00:00
|
|
|
isp_target_async(isp, bus, mbox);
|
1998-12-05 01:33:57 +00:00
|
|
|
#endif
|
1998-09-15 08:42:56 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ASYNC_EXTMSG_UNDERRUN:
|
|
|
|
PRINTF("%s: extended message underrun\n", isp->isp_name);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ASYNC_SCAM_INT:
|
|
|
|
PRINTF("%s: SCAM interrupt\n", isp->isp_name);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ASYNC_HUNG_SCSI:
|
|
|
|
PRINTF("%s: stalled SCSI Bus after DATA Overrun\n",
|
|
|
|
isp->isp_name);
|
|
|
|
/* XXX: Need to issue SCSI reset at this point */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ASYNC_KILLED_BUS:
|
|
|
|
PRINTF("%s: SCSI Bus reset after DATA Overrun\n",
|
|
|
|
isp->isp_name);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ASYNC_BUS_TRANSIT:
|
1999-03-25 22:52:45 +00:00
|
|
|
mbox = ISP_READ(isp, OUTMAILBOX2);
|
|
|
|
switch (mbox & 0x1c00) {
|
|
|
|
case SXP_PINS_LVD_MODE:
|
|
|
|
PRINTF("%s: Transition to LVD mode\n", isp->isp_name);
|
|
|
|
((sdparam *)isp->isp_param)->isp_diffmode = 0;
|
|
|
|
((sdparam *)isp->isp_param)->isp_ultramode = 0;
|
|
|
|
((sdparam *)isp->isp_param)->isp_lvdmode = 1;
|
|
|
|
break;
|
|
|
|
case SXP_PINS_HVD_MODE:
|
|
|
|
PRINTF("%s: Transition to Differential mode\n",
|
|
|
|
isp->isp_name);
|
|
|
|
((sdparam *)isp->isp_param)->isp_diffmode = 1;
|
|
|
|
((sdparam *)isp->isp_param)->isp_ultramode = 0;
|
|
|
|
((sdparam *)isp->isp_param)->isp_lvdmode = 0;
|
|
|
|
break;
|
|
|
|
case SXP_PINS_SE_MODE:
|
|
|
|
PRINTF("%s: Transition to Single Ended mode\n",
|
|
|
|
isp->isp_name);
|
|
|
|
((sdparam *)isp->isp_param)->isp_diffmode = 0;
|
|
|
|
((sdparam *)isp->isp_param)->isp_ultramode = 1;
|
|
|
|
((sdparam *)isp->isp_param)->isp_lvdmode = 0;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
PRINTF("%s: Transition to unknown mode 0x%x\n",
|
|
|
|
isp->isp_name, mbox);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* XXX: Set up to renegotiate again!
|
|
|
|
*/
|
1999-05-11 05:06:55 +00:00
|
|
|
/* Can only be for a 1080... */
|
1999-11-21 03:18:22 +00:00
|
|
|
isp->isp_sendmarker = (1 << bus);
|
1998-09-15 08:42:56 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ASYNC_CMD_CMPLT:
|
1999-01-30 07:29:00 +00:00
|
|
|
fast_post_handle = (ISP_READ(isp, OUTMAILBOX2) << 16) |
|
|
|
|
ISP_READ(isp, OUTMAILBOX1);
|
2000-01-09 21:47:39 +00:00
|
|
|
IDPRINTF(4, ("%s: fast post completion of %u\n", isp->isp_name,
|
1999-01-30 07:29:00 +00:00
|
|
|
fast_post_handle));
|
1998-09-15 08:42:56 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ASYNC_CTIO_DONE:
|
1998-12-05 01:33:57 +00:00
|
|
|
/* Should only occur when Fast Posting Set for 2100s */
|
1998-09-15 08:42:56 +00:00
|
|
|
PRINTF("%s: CTIO done\n", isp->isp_name);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ASYNC_LIP_OCCURRED:
|
1999-10-17 18:58:22 +00:00
|
|
|
((fcparam *) isp->isp_param)->isp_lipseq =
|
|
|
|
ISP_READ(isp, OUTMAILBOX1);
|
1999-04-04 02:28:29 +00:00
|
|
|
((fcparam *) isp->isp_param)->isp_fwstate = FW_CONFIG_WAIT;
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
((fcparam *) isp->isp_param)->isp_loopstate = LOOP_LIP_RCVD;
|
1999-03-17 05:04:39 +00:00
|
|
|
isp->isp_sendmarker = 1;
|
1999-04-04 02:28:29 +00:00
|
|
|
isp_mark_getpdb_all(isp);
|
1999-08-16 19:59:55 +00:00
|
|
|
IDPRINTF(1, ("%s: LIP occurred\n", isp->isp_name));
|
2000-01-03 23:52:41 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
|
|
|
isp_target_async(isp, bus, mbox);
|
|
|
|
#endif
|
1998-09-15 08:42:56 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ASYNC_LOOP_UP:
|
1999-03-17 05:04:39 +00:00
|
|
|
isp->isp_sendmarker = 1;
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
((fcparam *) isp->isp_param)->isp_fwstate = FW_CONFIG_WAIT;
|
|
|
|
((fcparam *) isp->isp_param)->isp_loopstate = LOOP_LIP_RCVD;
|
1999-04-04 02:28:29 +00:00
|
|
|
isp_mark_getpdb_all(isp);
|
1999-02-09 01:07:06 +00:00
|
|
|
isp_async(isp, ISPASYNC_LOOP_UP, NULL);
|
2000-01-03 23:52:41 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
|
|
|
isp_target_async(isp, bus, mbox);
|
|
|
|
#endif
|
1998-09-15 08:42:56 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ASYNC_LOOP_DOWN:
|
1999-04-04 02:28:29 +00:00
|
|
|
isp->isp_sendmarker = 1;
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
((fcparam *) isp->isp_param)->isp_fwstate = FW_CONFIG_WAIT;
|
|
|
|
((fcparam *) isp->isp_param)->isp_loopstate = LOOP_NIL;
|
1999-04-04 02:28:29 +00:00
|
|
|
isp_mark_getpdb_all(isp);
|
1999-02-09 01:07:06 +00:00
|
|
|
isp_async(isp, ISPASYNC_LOOP_DOWN, NULL);
|
2000-01-03 23:52:41 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
|
|
|
isp_target_async(isp, bus, mbox);
|
|
|
|
#endif
|
1998-09-15 08:42:56 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ASYNC_LOOP_RESET:
|
1999-11-21 03:18:22 +00:00
|
|
|
isp->isp_sendmarker = 1 << bus;
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
((fcparam *) isp->isp_param)->isp_fwstate = FW_CONFIG_WAIT;
|
|
|
|
((fcparam *) isp->isp_param)->isp_loopstate = LOOP_NIL;
|
1999-04-04 02:28:29 +00:00
|
|
|
isp_mark_getpdb_all(isp);
|
1998-09-15 08:42:56 +00:00
|
|
|
PRINTF("%s: Loop RESET\n", isp->isp_name);
|
1998-12-05 01:33:57 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
2000-01-03 23:52:41 +00:00
|
|
|
isp_target_async(isp, bus, mbox);
|
1998-12-05 01:33:57 +00:00
|
|
|
#endif
|
1998-09-15 08:42:56 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ASYNC_PDB_CHANGED:
|
1999-03-17 05:04:39 +00:00
|
|
|
isp->isp_sendmarker = 1;
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
((fcparam *) isp->isp_param)->isp_loopstate = LOOP_PDB_RCVD;
|
1999-03-17 05:04:39 +00:00
|
|
|
isp_mark_getpdb_all(isp);
|
1999-08-16 19:59:55 +00:00
|
|
|
IDPRINTF(2, ("%s: Port Database Changed\n", isp->isp_name));
|
1998-09-15 08:42:56 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ASYNC_CHANGE_NOTIFY:
|
1999-08-16 19:59:55 +00:00
|
|
|
isp_mark_getpdb_all(isp);
|
|
|
|
/*
|
|
|
|
* Not correct, but it will force us to rescan the loop.
|
|
|
|
*/
|
|
|
|
((fcparam *) isp->isp_param)->isp_loopstate = LOOP_PDB_RCVD;
|
|
|
|
isp_async(isp, ISPASYNC_CHANGE_NOTIFY, NULL);
|
1998-09-15 08:42:56 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
1999-03-17 05:04:39 +00:00
|
|
|
PRINTF("%s: unknown async code 0x%x\n", isp->isp_name, mbox);
|
1998-09-15 08:42:56 +00:00
|
|
|
break;
|
|
|
|
}
|
1999-01-30 07:29:00 +00:00
|
|
|
return (fast_post_handle);
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
|
|
|
|
1999-11-21 03:18:22 +00:00
|
|
|
/*
|
|
|
|
* Handle other response entries. A pointer to the request queue output
|
|
|
|
* index is here in case we want to eat several entries at once, although
|
|
|
|
* this is not used currently.
|
|
|
|
*/
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
static int
|
|
|
|
isp_handle_other_response(isp, sp, optrp)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
ispstatusreq_t *sp;
|
1999-11-21 03:18:22 +00:00
|
|
|
u_int16_t *optrp;
|
1998-09-15 08:42:56 +00:00
|
|
|
{
|
|
|
|
switch (sp->req_header.rqs_entry_type) {
|
1999-10-17 18:58:22 +00:00
|
|
|
case RQSTYPE_ATIO:
|
2000-01-03 23:52:41 +00:00
|
|
|
case RQSTYPE_CTIO:
|
1998-09-15 08:42:56 +00:00
|
|
|
case RQSTYPE_ENABLE_LUN:
|
1998-12-05 01:33:57 +00:00
|
|
|
case RQSTYPE_MODIFY_LUN:
|
1999-10-17 18:58:22 +00:00
|
|
|
case RQSTYPE_NOTIFY:
|
|
|
|
case RQSTYPE_NOTIFY_ACK:
|
|
|
|
case RQSTYPE_CTIO1:
|
1998-09-15 08:42:56 +00:00
|
|
|
case RQSTYPE_ATIO2:
|
|
|
|
case RQSTYPE_CTIO2:
|
1999-10-17 18:58:22 +00:00
|
|
|
case RQSTYPE_CTIO3:
|
|
|
|
#ifdef ISP_TARGET_MODE
|
2000-01-03 23:52:41 +00:00
|
|
|
return (isp_target_notify(isp, sp, optrp));
|
1999-10-17 18:58:22 +00:00
|
|
|
#else
|
|
|
|
/* FALLTHROUGH */
|
1998-09-15 08:42:56 +00:00
|
|
|
#endif
|
1999-10-17 18:58:22 +00:00
|
|
|
case RQSTYPE_REQUEST:
|
1998-09-15 08:42:56 +00:00
|
|
|
default:
|
1999-11-21 03:18:22 +00:00
|
|
|
PRINTF("%s: unhandled response type 0x%x\n", isp->isp_name,
|
|
|
|
sp->req_header.rqs_entry_type);
|
1998-09-15 08:42:56 +00:00
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
}
|
1998-12-05 01:33:57 +00:00
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
static void
|
|
|
|
isp_parse_status(isp, sp, xs)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
ispstatusreq_t *sp;
|
|
|
|
ISP_SCSI_XFER_T *xs;
|
|
|
|
{
|
|
|
|
switch (sp->req_completion_status) {
|
|
|
|
case RQCS_COMPLETE:
|
|
|
|
XS_SETERR(xs, HBA_NOERROR);
|
|
|
|
return;
|
|
|
|
|
|
|
|
case RQCS_INCOMPLETE:
|
|
|
|
if ((sp->req_state_flags & RQSF_GOT_TARGET) == 0) {
|
1998-09-15 08:42:56 +00:00
|
|
|
IDPRINTF(3, ("%s: Selection Timeout for target %d\n",
|
|
|
|
isp->isp_name, XS_TGT(xs)));
|
1998-04-22 17:54:58 +00:00
|
|
|
XS_SETERR(xs, HBA_SELTIMEOUT);
|
|
|
|
return;
|
|
|
|
}
|
1998-09-15 08:42:56 +00:00
|
|
|
PRINTF("%s: command incomplete for target %d lun %d, state "
|
|
|
|
"0x%x\n", isp->isp_name, XS_TGT(xs), XS_LUN(xs),
|
|
|
|
sp->req_state_flags);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_DMA_ERROR:
|
|
|
|
PRINTF("%s: DMA error for command on target %d, lun %d\n",
|
|
|
|
isp->isp_name, XS_TGT(xs), XS_LUN(xs));
|
1998-04-22 17:54:58 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_TRANSPORT_ERROR:
|
|
|
|
PRINTF("%s: transport error\n", isp->isp_name);
|
|
|
|
isp_prtstst(sp);
|
|
|
|
break;
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
case RQCS_RESET_OCCURRED:
|
1999-12-16 05:42:02 +00:00
|
|
|
IDPRINTF(2, ("%s: bus %d reset destroyed command for target %d "
|
|
|
|
"lun %d\n", isp->isp_name, XS_CHANNEL(xs), XS_TGT(xs),
|
|
|
|
XS_LUN(xs)));
|
1999-05-11 05:06:55 +00:00
|
|
|
/*
|
|
|
|
* XXX: Get port number for bus
|
|
|
|
*/
|
|
|
|
isp->isp_sendmarker = 3;
|
1998-09-15 08:42:56 +00:00
|
|
|
XS_SETERR(xs, HBA_BUSRESET);
|
|
|
|
return;
|
|
|
|
|
|
|
|
case RQCS_ABORTED:
|
|
|
|
PRINTF("%s: command aborted for target %d lun %d\n",
|
|
|
|
isp->isp_name, XS_TGT(xs), XS_LUN(xs));
|
1999-05-11 05:06:55 +00:00
|
|
|
/*
|
|
|
|
* XXX: Get port number for bus
|
|
|
|
*/
|
|
|
|
isp->isp_sendmarker = 3;
|
1998-09-15 08:42:56 +00:00
|
|
|
XS_SETERR(xs, HBA_ABORTED);
|
|
|
|
return;
|
|
|
|
|
|
|
|
case RQCS_TIMEOUT:
|
|
|
|
IDPRINTF(2, ("%s: command timed out for target %d lun %d\n",
|
|
|
|
isp->isp_name, XS_TGT(xs), XS_LUN(xs)));
|
|
|
|
XS_SETERR(xs, HBA_CMDTIMEOUT);
|
|
|
|
return;
|
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
case RQCS_DATA_OVERRUN:
|
1999-08-16 19:59:55 +00:00
|
|
|
if (IS_FC(isp)) {
|
1998-04-22 17:54:58 +00:00
|
|
|
XS_RESID(xs) = sp->req_resid;
|
|
|
|
break;
|
|
|
|
}
|
1998-09-15 08:42:56 +00:00
|
|
|
XS_SETERR(xs, HBA_DATAOVR);
|
1998-04-22 17:54:58 +00:00
|
|
|
return;
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
case RQCS_COMMAND_OVERRUN:
|
|
|
|
PRINTF("%s: command overrun for command on target %d, lun %d\n",
|
|
|
|
isp->isp_name, XS_TGT(xs), XS_LUN(xs));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_STATUS_OVERRUN:
|
|
|
|
PRINTF("%s: status overrun for command on target %d, lun %d\n",
|
|
|
|
isp->isp_name, XS_TGT(xs), XS_LUN(xs));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_BAD_MESSAGE:
|
|
|
|
PRINTF("%s: message not COMMAND COMPLETE after status on "
|
|
|
|
"target %d, lun %d\n", isp->isp_name, XS_TGT(xs),
|
|
|
|
XS_LUN(xs));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_NO_MESSAGE_OUT:
|
|
|
|
PRINTF("%s: No MESSAGE OUT phase after selection on "
|
|
|
|
"target %d, lun %d\n", isp->isp_name, XS_TGT(xs),
|
|
|
|
XS_LUN(xs));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_EXT_ID_FAILED:
|
|
|
|
PRINTF("%s: EXTENDED IDENTIFY failed on target %d, lun %d\n",
|
|
|
|
isp->isp_name, XS_TGT(xs), XS_LUN(xs));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_IDE_MSG_FAILED:
|
|
|
|
PRINTF("%s: target %d lun %d rejected INITIATOR DETECTED "
|
|
|
|
"ERROR message\n", isp->isp_name, XS_TGT(xs), XS_LUN(xs));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_ABORT_MSG_FAILED:
|
|
|
|
PRINTF("%s: target %d lun %d rejected ABORT message\n",
|
|
|
|
isp->isp_name, XS_TGT(xs), XS_LUN(xs));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_REJECT_MSG_FAILED:
|
|
|
|
PRINTF("%s: target %d lun %d rejected MESSAGE REJECT message\n",
|
|
|
|
isp->isp_name, XS_TGT(xs), XS_LUN(xs));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_NOP_MSG_FAILED:
|
|
|
|
PRINTF("%s: target %d lun %d rejected NOP message\n",
|
|
|
|
isp->isp_name, XS_TGT(xs), XS_LUN(xs));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_PARITY_ERROR_MSG_FAILED:
|
|
|
|
PRINTF("%s: target %d lun %d rejected MESSAGE PARITY ERROR "
|
|
|
|
"message\n", isp->isp_name, XS_TGT(xs), XS_LUN(xs));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_DEVICE_RESET_MSG_FAILED:
|
|
|
|
PRINTF("%s: target %d lun %d rejected BUS DEVICE RESET "
|
|
|
|
"message\n", isp->isp_name, XS_TGT(xs), XS_LUN(xs));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_ID_MSG_FAILED:
|
|
|
|
PRINTF("%s: target %d lun %d rejected IDENTIFY "
|
|
|
|
"message\n", isp->isp_name, XS_TGT(xs), XS_LUN(xs));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_UNEXP_BUS_FREE:
|
1998-12-05 01:33:57 +00:00
|
|
|
PRINTF("%s: target %d lun %d had an unexpected bus free\n",
|
1998-09-15 08:42:56 +00:00
|
|
|
isp->isp_name, XS_TGT(xs), XS_LUN(xs));
|
|
|
|
break;
|
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
case RQCS_DATA_UNDERRUN:
|
1999-08-16 19:59:55 +00:00
|
|
|
if (IS_FC(isp)) {
|
1998-04-22 17:54:58 +00:00
|
|
|
XS_RESID(xs) = sp->req_resid;
|
|
|
|
/* an UNDERRUN is not a botch ??? */
|
|
|
|
}
|
|
|
|
XS_SETERR(xs, HBA_NOERROR);
|
|
|
|
return;
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
case RQCS_XACT_ERR1:
|
|
|
|
PRINTF("%s: HBA attempted queued transaction with disconnect "
|
|
|
|
"not set for target %d lun %d\n", isp->isp_name, XS_TGT(xs),
|
|
|
|
XS_LUN(xs));
|
|
|
|
break;
|
1998-04-22 17:54:58 +00:00
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
case RQCS_XACT_ERR2:
|
|
|
|
PRINTF("%s: HBA attempted queued transaction to target "
|
|
|
|
"routine %d on target %d\n", isp->isp_name, XS_LUN(xs),
|
|
|
|
XS_TGT(xs));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_XACT_ERR3:
|
|
|
|
PRINTF("%s: HBA attempted queued transaction for target %d lun "
|
|
|
|
"%d when queueing disabled\n", isp->isp_name, XS_TGT(xs),
|
|
|
|
XS_LUN(xs));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_BAD_ENTRY:
|
|
|
|
PRINTF("%s: invalid IOCB entry type detected\n", isp->isp_name);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_QUEUE_FULL:
|
1999-05-11 05:06:55 +00:00
|
|
|
IDPRINTF(3, ("%s: internal queues full for target %d lun %d "
|
1999-01-10 02:55:10 +00:00
|
|
|
"status 0x%x\n", isp->isp_name, XS_TGT(xs), XS_LUN(xs),
|
1999-05-11 05:06:55 +00:00
|
|
|
XS_STS(xs)));
|
1999-01-10 02:55:10 +00:00
|
|
|
/*
|
|
|
|
* If QFULL or some other status byte is set, then this
|
|
|
|
* isn't an error, per se.
|
|
|
|
*/
|
|
|
|
if (XS_STS(xs) != 0) {
|
|
|
|
XS_SETERR(xs, HBA_NOERROR);
|
|
|
|
return;
|
|
|
|
}
|
1998-09-15 08:42:56 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_PHASE_SKIPPED:
|
|
|
|
PRINTF("%s: SCSI phase skipped (e.g., COMMAND COMPLETE w/o "
|
|
|
|
"STATUS phase) for target %d lun %d\n", isp->isp_name,
|
|
|
|
XS_TGT(xs), XS_LUN(xs));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_ARQS_FAILED:
|
|
|
|
PRINTF("%s: Auto Request Sense failed for target %d lun %d\n",
|
|
|
|
isp->isp_name, XS_TGT(xs), XS_LUN(xs));
|
|
|
|
XS_SETERR(xs, HBA_ARQFAIL);
|
1998-04-22 17:54:58 +00:00
|
|
|
return;
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
case RQCS_WIDE_FAILED:
|
|
|
|
PRINTF("%s: Wide Negotiation failed for target %d lun %d\n",
|
|
|
|
isp->isp_name, XS_TGT(xs), XS_LUN(xs));
|
1999-05-11 05:06:55 +00:00
|
|
|
if (IS_SCSI(isp)) {
|
1998-09-15 08:42:56 +00:00
|
|
|
sdparam *sdp = isp->isp_param;
|
1999-05-11 05:06:55 +00:00
|
|
|
sdp += XS_CHANNEL(xs);
|
1998-09-15 08:42:56 +00:00
|
|
|
sdp->isp_devparam[XS_TGT(xs)].dev_flags &= ~DPARM_WIDE;
|
1999-01-30 07:29:00 +00:00
|
|
|
sdp->isp_devparam[XS_TGT(xs)].dev_update = 1;
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_update = XS_CHANNEL(xs)+1;
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
|
|
|
XS_SETERR(xs, HBA_NOERROR);
|
1998-04-22 17:54:58 +00:00
|
|
|
return;
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
case RQCS_SYNCXFER_FAILED:
|
|
|
|
PRINTF("%s: SDTR Message failed for target %d lun %d\n",
|
|
|
|
isp->isp_name, XS_TGT(xs), XS_LUN(xs));
|
1999-05-11 05:06:55 +00:00
|
|
|
if (IS_SCSI(isp)) {
|
1998-09-15 08:42:56 +00:00
|
|
|
sdparam *sdp = isp->isp_param;
|
1999-05-11 05:06:55 +00:00
|
|
|
sdp += XS_CHANNEL(xs);
|
1998-09-15 08:42:56 +00:00
|
|
|
sdp->isp_devparam[XS_TGT(xs)].dev_flags &= ~DPARM_SYNC;
|
1999-01-30 07:29:00 +00:00
|
|
|
sdp->isp_devparam[XS_TGT(xs)].dev_update = 1;
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_update = XS_CHANNEL(xs)+1;
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_LVD_BUSERR:
|
|
|
|
PRINTF("%s: Bad LVD Bus condition while talking to target %d "
|
|
|
|
"lun %d\n", isp->isp_name, XS_TGT(xs), XS_LUN(xs));
|
|
|
|
break;
|
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
case RQCS_PORT_UNAVAILABLE:
|
|
|
|
/*
|
|
|
|
* No such port on the loop. Moral equivalent of SELTIMEO
|
|
|
|
*/
|
1998-09-15 08:42:56 +00:00
|
|
|
IDPRINTF(3, ("%s: Port Unavailable for target %d\n",
|
|
|
|
isp->isp_name, XS_TGT(xs)));
|
1998-04-22 17:54:58 +00:00
|
|
|
XS_SETERR(xs, HBA_SELTIMEOUT);
|
|
|
|
return;
|
|
|
|
|
|
|
|
case RQCS_PORT_LOGGED_OUT:
|
1998-09-15 08:42:56 +00:00
|
|
|
/*
|
|
|
|
* It was there (maybe)- treat as a selection timeout.
|
|
|
|
*/
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
IDPRINTF(2, ("%s: port logout for target %d\n",
|
|
|
|
isp->isp_name, XS_TGT(xs)));
|
1998-09-15 08:42:56 +00:00
|
|
|
XS_SETERR(xs, HBA_SELTIMEOUT);
|
|
|
|
return;
|
1998-04-22 17:54:58 +00:00
|
|
|
|
|
|
|
case RQCS_PORT_CHANGED:
|
|
|
|
PRINTF("%s: port changed for target %d\n",
|
|
|
|
isp->isp_name, XS_TGT(xs));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RQCS_PORT_BUSY:
|
|
|
|
PRINTF("%s: port busy for target %d\n",
|
|
|
|
isp->isp_name, XS_TGT(xs));
|
|
|
|
XS_SETERR(xs, HBA_TGTBSY);
|
|
|
|
return;
|
|
|
|
|
|
|
|
default:
|
|
|
|
PRINTF("%s: comp status %x\n", isp->isp_name,
|
1999-03-25 22:52:45 +00:00
|
|
|
sp->req_completion_status);
|
1998-04-22 17:54:58 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
XS_SETERR(xs, HBA_BOTCH);
|
|
|
|
}
|
|
|
|
|
1999-03-17 05:04:39 +00:00
|
|
|
static void
|
|
|
|
isp_fastpost_complete(isp, fph)
|
|
|
|
struct ispsoftc *isp;
|
1999-10-17 18:58:22 +00:00
|
|
|
u_int32_t fph;
|
1999-03-17 05:04:39 +00:00
|
|
|
{
|
|
|
|
ISP_SCSI_XFER_T *xs;
|
|
|
|
|
1999-10-17 18:58:22 +00:00
|
|
|
if (fph < 1) {
|
1999-03-17 05:04:39 +00:00
|
|
|
return;
|
1999-10-17 18:58:22 +00:00
|
|
|
}
|
|
|
|
xs = isp_find_xs(isp, fph);
|
1999-03-17 05:04:39 +00:00
|
|
|
if (xs == NULL) {
|
1999-10-17 18:58:22 +00:00
|
|
|
PRINTF("%s: command for fast posting handle 0x%x not found\n",
|
|
|
|
isp->isp_name, fph);
|
1999-03-17 05:04:39 +00:00
|
|
|
return;
|
|
|
|
}
|
1999-10-17 18:58:22 +00:00
|
|
|
isp_destroy_handle(isp, fph);
|
|
|
|
|
1999-03-17 05:04:39 +00:00
|
|
|
/*
|
|
|
|
* Since we don't have a result queue entry item,
|
|
|
|
* we must believe that SCSI status is zero and
|
|
|
|
* that all data transferred.
|
|
|
|
*/
|
|
|
|
XS_RESID(xs) = 0;
|
|
|
|
XS_STS(xs) = 0;
|
|
|
|
if (XS_XFRLEN(xs)) {
|
1999-10-17 18:58:22 +00:00
|
|
|
ISP_DMAFREE(isp, xs, fph);
|
1999-03-17 05:04:39 +00:00
|
|
|
}
|
|
|
|
XS_CMD_DONE(xs);
|
1999-10-17 18:58:22 +00:00
|
|
|
if (isp->isp_nactive)
|
|
|
|
isp->isp_nactive--;
|
1999-03-17 05:04:39 +00:00
|
|
|
}
|
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
#define HINIB(x) ((x) >> 0x4)
|
|
|
|
#define LONIB(x) ((x) & 0xf)
|
1999-03-25 22:52:45 +00:00
|
|
|
#define MAKNIB(a, b) (((a) << 4) | (b))
|
1998-04-22 17:54:58 +00:00
|
|
|
static u_int8_t mbpcnt[] = {
|
|
|
|
MAKNIB(1, 1), /* 0x00: MBOX_NO_OP */
|
|
|
|
MAKNIB(5, 5), /* 0x01: MBOX_LOAD_RAM */
|
|
|
|
MAKNIB(2, 0), /* 0x02: MBOX_EXEC_FIRMWARE */
|
|
|
|
MAKNIB(5, 5), /* 0x03: MBOX_DUMP_RAM */
|
|
|
|
MAKNIB(3, 3), /* 0x04: MBOX_WRITE_RAM_WORD */
|
|
|
|
MAKNIB(2, 3), /* 0x05: MBOX_READ_RAM_WORD */
|
|
|
|
MAKNIB(6, 6), /* 0x06: MBOX_MAILBOX_REG_TEST */
|
|
|
|
MAKNIB(2, 3), /* 0x07: MBOX_VERIFY_CHECKSUM */
|
1999-04-04 02:28:29 +00:00
|
|
|
MAKNIB(1, 4), /* 0x08: MBOX_ABOUT_FIRMWARE */
|
1998-04-22 17:54:58 +00:00
|
|
|
MAKNIB(0, 0), /* 0x09: */
|
|
|
|
MAKNIB(0, 0), /* 0x0a: */
|
|
|
|
MAKNIB(0, 0), /* 0x0b: */
|
|
|
|
MAKNIB(0, 0), /* 0x0c: */
|
|
|
|
MAKNIB(0, 0), /* 0x0d: */
|
|
|
|
MAKNIB(1, 2), /* 0x0e: MBOX_CHECK_FIRMWARE */
|
|
|
|
MAKNIB(0, 0), /* 0x0f: */
|
|
|
|
MAKNIB(5, 5), /* 0x10: MBOX_INIT_REQ_QUEUE */
|
|
|
|
MAKNIB(6, 6), /* 0x11: MBOX_INIT_RES_QUEUE */
|
|
|
|
MAKNIB(4, 4), /* 0x12: MBOX_EXECUTE_IOCB */
|
|
|
|
MAKNIB(2, 2), /* 0x13: MBOX_WAKE_UP */
|
|
|
|
MAKNIB(1, 6), /* 0x14: MBOX_STOP_FIRMWARE */
|
|
|
|
MAKNIB(4, 4), /* 0x15: MBOX_ABORT */
|
|
|
|
MAKNIB(2, 2), /* 0x16: MBOX_ABORT_DEVICE */
|
|
|
|
MAKNIB(3, 3), /* 0x17: MBOX_ABORT_TARGET */
|
1999-03-25 22:52:45 +00:00
|
|
|
MAKNIB(3, 1), /* 0x18: MBOX_BUS_RESET */
|
1998-04-22 17:54:58 +00:00
|
|
|
MAKNIB(2, 3), /* 0x19: MBOX_STOP_QUEUE */
|
|
|
|
MAKNIB(2, 3), /* 0x1a: MBOX_START_QUEUE */
|
|
|
|
MAKNIB(2, 3), /* 0x1b: MBOX_SINGLE_STEP_QUEUE */
|
|
|
|
MAKNIB(2, 3), /* 0x1c: MBOX_ABORT_QUEUE */
|
|
|
|
MAKNIB(2, 4), /* 0x1d: MBOX_GET_DEV_QUEUE_STATUS */
|
|
|
|
MAKNIB(0, 0), /* 0x1e: */
|
|
|
|
MAKNIB(1, 3), /* 0x1f: MBOX_GET_FIRMWARE_STATUS */
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
MAKNIB(1, 4), /* 0x20: MBOX_GET_INIT_SCSI_ID, MBOX_GET_LOOP_ID */
|
1999-05-11 05:06:55 +00:00
|
|
|
MAKNIB(1, 3), /* 0x21: MBOX_GET_SELECT_TIMEOUT */
|
1998-04-22 17:54:58 +00:00
|
|
|
MAKNIB(1, 3), /* 0x22: MBOX_GET_RETRY_COUNT */
|
|
|
|
MAKNIB(1, 2), /* 0x23: MBOX_GET_TAG_AGE_LIMIT */
|
|
|
|
MAKNIB(1, 2), /* 0x24: MBOX_GET_CLOCK_RATE */
|
|
|
|
MAKNIB(1, 2), /* 0x25: MBOX_GET_ACT_NEG_STATE */
|
|
|
|
MAKNIB(1, 2), /* 0x26: MBOX_GET_ASYNC_DATA_SETUP_TIME */
|
|
|
|
MAKNIB(1, 3), /* 0x27: MBOX_GET_PCI_PARAMS */
|
|
|
|
MAKNIB(2, 4), /* 0x28: MBOX_GET_TARGET_PARAMS */
|
|
|
|
MAKNIB(2, 4), /* 0x29: MBOX_GET_DEV_QUEUE_PARAMS */
|
1999-05-11 05:06:55 +00:00
|
|
|
MAKNIB(1, 2), /* 0x2a: MBOX_GET_RESET_DELAY_PARAMS */
|
1998-04-22 17:54:58 +00:00
|
|
|
MAKNIB(0, 0), /* 0x2b: */
|
|
|
|
MAKNIB(0, 0), /* 0x2c: */
|
|
|
|
MAKNIB(0, 0), /* 0x2d: */
|
|
|
|
MAKNIB(0, 0), /* 0x2e: */
|
|
|
|
MAKNIB(0, 0), /* 0x2f: */
|
|
|
|
MAKNIB(2, 2), /* 0x30: MBOX_SET_INIT_SCSI_ID */
|
1999-05-11 05:06:55 +00:00
|
|
|
MAKNIB(2, 3), /* 0x31: MBOX_SET_SELECT_TIMEOUT */
|
1998-04-22 17:54:58 +00:00
|
|
|
MAKNIB(3, 3), /* 0x32: MBOX_SET_RETRY_COUNT */
|
|
|
|
MAKNIB(2, 2), /* 0x33: MBOX_SET_TAG_AGE_LIMIT */
|
|
|
|
MAKNIB(2, 2), /* 0x34: MBOX_SET_CLOCK_RATE */
|
1999-05-11 05:06:55 +00:00
|
|
|
MAKNIB(2, 2), /* 0x35: MBOX_SET_ACT_NEG_STATE */
|
1998-04-22 17:54:58 +00:00
|
|
|
MAKNIB(2, 2), /* 0x36: MBOX_SET_ASYNC_DATA_SETUP_TIME */
|
|
|
|
MAKNIB(3, 3), /* 0x37: MBOX_SET_PCI_CONTROL_PARAMS */
|
|
|
|
MAKNIB(4, 4), /* 0x38: MBOX_SET_TARGET_PARAMS */
|
|
|
|
MAKNIB(4, 4), /* 0x39: MBOX_SET_DEV_QUEUE_PARAMS */
|
1999-05-11 05:06:55 +00:00
|
|
|
MAKNIB(1, 2), /* 0x3a: MBOX_SET_RESET_DELAY_PARAMS */
|
1998-04-22 17:54:58 +00:00
|
|
|
MAKNIB(0, 0), /* 0x3b: */
|
|
|
|
MAKNIB(0, 0), /* 0x3c: */
|
|
|
|
MAKNIB(0, 0), /* 0x3d: */
|
|
|
|
MAKNIB(0, 0), /* 0x3e: */
|
|
|
|
MAKNIB(0, 0), /* 0x3f: */
|
|
|
|
MAKNIB(1, 2), /* 0x40: MBOX_RETURN_BIOS_BLOCK_ADDR */
|
|
|
|
MAKNIB(6, 1), /* 0x41: MBOX_WRITE_FOUR_RAM_WORDS */
|
|
|
|
MAKNIB(2, 3), /* 0x42: MBOX_EXEC_BIOS_IOCB */
|
|
|
|
MAKNIB(0, 0), /* 0x43: */
|
|
|
|
MAKNIB(0, 0), /* 0x44: */
|
|
|
|
MAKNIB(0, 0), /* 0x45: */
|
|
|
|
MAKNIB(0, 0), /* 0x46: */
|
|
|
|
MAKNIB(0, 0), /* 0x47: */
|
|
|
|
MAKNIB(0, 0), /* 0x48: */
|
|
|
|
MAKNIB(0, 0), /* 0x49: */
|
1999-01-30 07:29:00 +00:00
|
|
|
MAKNIB(2, 1), /* 0x4a: MBOX_SET_FIRMWARE_FEATURES */
|
|
|
|
MAKNIB(1, 2), /* 0x4b: MBOX_GET_FIRMWARE_FEATURES */
|
1998-04-22 17:54:58 +00:00
|
|
|
MAKNIB(0, 0), /* 0x4c: */
|
|
|
|
MAKNIB(0, 0), /* 0x4d: */
|
|
|
|
MAKNIB(0, 0), /* 0x4e: */
|
|
|
|
MAKNIB(0, 0), /* 0x4f: */
|
|
|
|
MAKNIB(0, 0), /* 0x50: */
|
|
|
|
MAKNIB(0, 0), /* 0x51: */
|
|
|
|
MAKNIB(0, 0), /* 0x52: */
|
|
|
|
MAKNIB(0, 0), /* 0x53: */
|
|
|
|
MAKNIB(8, 0), /* 0x54: MBOX_EXEC_COMMAND_IOCB_A64 */
|
2000-01-03 23:52:41 +00:00
|
|
|
MAKNIB(2, 1), /* 0x55: MBOX_ENABLE_TARGET_MODE */
|
1998-04-22 17:54:58 +00:00
|
|
|
MAKNIB(0, 0), /* 0x56: */
|
|
|
|
MAKNIB(0, 0), /* 0x57: */
|
|
|
|
MAKNIB(0, 0), /* 0x58: */
|
|
|
|
MAKNIB(0, 0), /* 0x59: */
|
|
|
|
MAKNIB(0, 0), /* 0x5a: */
|
|
|
|
MAKNIB(0, 0), /* 0x5b: */
|
|
|
|
MAKNIB(0, 0), /* 0x5c: */
|
|
|
|
MAKNIB(0, 0), /* 0x5d: */
|
|
|
|
MAKNIB(0, 0), /* 0x5e: */
|
|
|
|
MAKNIB(0, 0), /* 0x5f: */
|
|
|
|
MAKNIB(8, 6), /* 0x60: MBOX_INIT_FIRMWARE */
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
MAKNIB(0, 0), /* 0x61: */
|
1998-04-22 17:54:58 +00:00
|
|
|
MAKNIB(2, 1), /* 0x62: MBOX_INIT_LIP */
|
|
|
|
MAKNIB(8, 1), /* 0x63: MBOX_GET_FC_AL_POSITION_MAP */
|
|
|
|
MAKNIB(8, 1), /* 0x64: MBOX_GET_PORT_DB */
|
|
|
|
MAKNIB(3, 1), /* 0x65: MBOX_CLEAR_ACA */
|
|
|
|
MAKNIB(3, 1), /* 0x66: MBOX_TARGET_RESET */
|
|
|
|
MAKNIB(3, 1), /* 0x67: MBOX_CLEAR_TASK_SET */
|
1999-03-17 05:04:39 +00:00
|
|
|
MAKNIB(3, 1), /* 0x68: MBOX_ABORT_TASK_SET */
|
|
|
|
MAKNIB(1, 2), /* 0x69: MBOX_GET_FW_STATE */
|
|
|
|
MAKNIB(2, 8), /* 0x6a: MBOX_GET_PORT_NAME */
|
|
|
|
MAKNIB(8, 1), /* 0x6b: MBOX_GET_LINK_STATUS */
|
|
|
|
MAKNIB(4, 4), /* 0x6c: MBOX_INIT_LIP_RESET */
|
|
|
|
MAKNIB(0, 0), /* 0x6d: */
|
1999-11-21 03:18:22 +00:00
|
|
|
MAKNIB(8, 2), /* 0x6e: MBOX_SEND_SNS */
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
MAKNIB(4, 3), /* 0x6f: MBOX_FABRIC_LOGIN */
|
|
|
|
MAKNIB(2, 1), /* 0x70: MBOX_SEND_CHANGE_REQUEST */
|
|
|
|
MAKNIB(2, 1), /* 0x71: MBOX_FABRIC_LOGOUT */
|
1999-03-17 05:04:39 +00:00
|
|
|
MAKNIB(4, 1) /* 0x72: MBOX_INIT_LIP_LOGIN */
|
1998-04-22 17:54:58 +00:00
|
|
|
};
|
|
|
|
#define NMBCOM (sizeof (mbpcnt) / sizeof (mbpcnt[0]))
|
|
|
|
|
|
|
|
static void
|
|
|
|
isp_mboxcmd(isp, mbp)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
mbreg_t *mbp;
|
|
|
|
{
|
|
|
|
int outparam, inparam;
|
1998-09-15 08:42:56 +00:00
|
|
|
int loops, dld = 0;
|
1998-04-22 17:54:58 +00:00
|
|
|
u_int8_t opcode;
|
|
|
|
|
|
|
|
if (mbp->param[0] == ISP2100_SET_PCI_PARAM) {
|
|
|
|
opcode = mbp->param[0] = MBOX_SET_PCI_PARAMETERS;
|
|
|
|
inparam = 4;
|
|
|
|
outparam = 4;
|
|
|
|
goto command_known;
|
|
|
|
} else if (mbp->param[0] > NMBCOM) {
|
|
|
|
PRINTF("%s: bad command %x\n", isp->isp_name, mbp->param[0]);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
opcode = mbp->param[0];
|
|
|
|
inparam = HINIB(mbpcnt[mbp->param[0]]);
|
|
|
|
outparam = LONIB(mbpcnt[mbp->param[0]]);
|
|
|
|
|
|
|
|
if (inparam == 0 && outparam == 0) {
|
|
|
|
PRINTF("%s: no parameters for %x\n", isp->isp_name,
|
|
|
|
mbp->param[0]);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-12-05 01:33:57 +00:00
|
|
|
/*
|
|
|
|
* Check for variants
|
|
|
|
*/
|
1999-03-17 05:04:39 +00:00
|
|
|
#ifdef ISP2100_SCCLUN
|
1999-08-16 19:59:55 +00:00
|
|
|
if (IS_FC(isp)) {
|
1998-12-05 01:33:57 +00:00
|
|
|
switch (mbp->param[0]) {
|
|
|
|
case MBOX_ABORT:
|
|
|
|
inparam = 7;
|
|
|
|
break;
|
|
|
|
case MBOX_ABORT_DEVICE:
|
|
|
|
case MBOX_START_QUEUE:
|
|
|
|
case MBOX_STOP_QUEUE:
|
|
|
|
case MBOX_SINGLE_STEP_QUEUE:
|
|
|
|
case MBOX_ABORT_QUEUE:
|
|
|
|
case MBOX_GET_DEV_QUEUE_STATUS:
|
|
|
|
inparam = 3;
|
|
|
|
break;
|
1999-08-16 19:59:55 +00:00
|
|
|
case MBOX_BUS_RESET:
|
|
|
|
inparam = 2;
|
|
|
|
break;
|
1998-12-05 01:33:57 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
command_known:
|
1998-09-15 08:42:56 +00:00
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
/*
|
1999-03-17 05:04:39 +00:00
|
|
|
* Set semaphore on mailbox registers to win any races to acquire them.
|
|
|
|
*/
|
|
|
|
ISP_WRITE(isp, BIU_SEMA, 1);
|
|
|
|
|
1999-08-16 19:59:55 +00:00
|
|
|
/*
|
|
|
|
* Qlogic Errata for the ISP2100 says that there is a necessary
|
|
|
|
* debounce between between writing the semaphore register
|
|
|
|
* and reading a mailbox register. I believe we're okay here.
|
|
|
|
*/
|
|
|
|
|
1999-03-17 05:04:39 +00:00
|
|
|
/*
|
1999-05-11 05:06:55 +00:00
|
|
|
* Make sure we can send some words.
|
|
|
|
* Check to see if there's an async mbox event pending.
|
1998-04-22 17:54:58 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
loops = MBOX_DELAY_COUNT;
|
|
|
|
while ((ISP_READ(isp, HCCR) & HCCR_HOST_INT) != 0) {
|
1999-03-17 05:04:39 +00:00
|
|
|
if (ISP_READ(isp, BIU_SEMA) & 1) {
|
|
|
|
int fph;
|
|
|
|
u_int16_t mbox = ISP_READ(isp, OUTMAILBOX0);
|
|
|
|
/*
|
|
|
|
* We have a pending MBOX async event.
|
|
|
|
*/
|
|
|
|
if (mbox & 0x8000) {
|
|
|
|
fph = isp_parse_async(isp, (int) mbox);
|
1999-10-17 18:58:22 +00:00
|
|
|
IDPRINTF(5, ("%s: line %d, fph %d\n",
|
|
|
|
isp->isp_name, __LINE__, fph));
|
1999-03-17 05:04:39 +00:00
|
|
|
ISP_WRITE(isp, BIU_SEMA, 0);
|
|
|
|
ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT);
|
|
|
|
if (fph < 0) {
|
1998-09-15 08:42:56 +00:00
|
|
|
return;
|
1999-03-17 05:04:39 +00:00
|
|
|
} else if (fph > 0) {
|
|
|
|
isp_fastpost_complete(isp, fph);
|
|
|
|
}
|
|
|
|
SYS_DELAY(100);
|
|
|
|
goto command_known;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* We have a pending MBOX completion? Might be
|
|
|
|
* from a previous command. We can't (sometimes)
|
|
|
|
* just clear HOST INTERRUPT, so we'll just silently
|
|
|
|
* eat this here.
|
|
|
|
*/
|
1999-05-11 05:06:55 +00:00
|
|
|
if (mbox & 0x4000) {
|
1999-10-17 18:58:22 +00:00
|
|
|
IDPRINTF(5, ("%s: line %d, mbox 0x%x\n",
|
|
|
|
isp->isp_name, __LINE__, mbox));
|
1998-09-15 08:42:56 +00:00
|
|
|
ISP_WRITE(isp, BIU_SEMA, 0);
|
1999-03-17 05:04:39 +00:00
|
|
|
ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT);
|
|
|
|
SYS_DELAY(100);
|
|
|
|
goto command_known;
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
1999-03-17 05:04:39 +00:00
|
|
|
}
|
1999-05-11 05:06:55 +00:00
|
|
|
SYS_DELAY(100);
|
1999-03-17 05:04:39 +00:00
|
|
|
if (--loops < 0) {
|
|
|
|
if (dld++ > 10) {
|
|
|
|
PRINTF("%s: isp_mboxcmd could not get command "
|
|
|
|
"started\n", isp->isp_name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ISP_WRITE(isp, BIU_SEMA, 0);
|
1998-09-15 08:42:56 +00:00
|
|
|
ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT);
|
|
|
|
goto command_known;
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-03-25 22:52:45 +00:00
|
|
|
/*
|
1999-05-11 05:06:55 +00:00
|
|
|
* Write input parameters.
|
|
|
|
*
|
|
|
|
* Special case some of the setups for the dual port SCSI cards.
|
|
|
|
* XXX Eventually will be fixed by converting register write/read
|
|
|
|
* XXX counts to bitmasks.
|
1999-03-25 22:52:45 +00:00
|
|
|
*/
|
1999-12-16 05:42:02 +00:00
|
|
|
if (IS_DUALBUS(isp)) {
|
1999-05-11 05:06:55 +00:00
|
|
|
switch (opcode) {
|
|
|
|
case MBOX_GET_RETRY_COUNT:
|
|
|
|
case MBOX_SET_RETRY_COUNT:
|
|
|
|
ISP_WRITE(isp, INMAILBOX7, mbp->param[7]);
|
|
|
|
mbp->param[7] = 0;
|
|
|
|
ISP_WRITE(isp, INMAILBOX6, mbp->param[6]);
|
|
|
|
mbp->param[6] = 0;
|
1999-03-25 22:52:45 +00:00
|
|
|
break;
|
1999-05-11 05:06:55 +00:00
|
|
|
case MBOX_SET_ASYNC_DATA_SETUP_TIME:
|
|
|
|
case MBOX_SET_ACT_NEG_STATE:
|
|
|
|
case MBOX_SET_TAG_AGE_LIMIT:
|
|
|
|
case MBOX_SET_SELECT_TIMEOUT:
|
|
|
|
ISP_WRITE(isp, INMAILBOX2, mbp->param[2]);
|
1999-10-17 18:58:22 +00:00
|
|
|
mbp->param[2] = 0;
|
1999-03-25 22:52:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
switch (inparam) {
|
|
|
|
case 8: ISP_WRITE(isp, INMAILBOX7, mbp->param[7]); mbp->param[7] = 0;
|
|
|
|
case 7: ISP_WRITE(isp, INMAILBOX6, mbp->param[6]); mbp->param[6] = 0;
|
1999-03-25 22:52:45 +00:00
|
|
|
case 6:
|
|
|
|
/*
|
|
|
|
* The Qlogic 2100 cannot have registers 4 and 5 written to
|
|
|
|
* after initialization or BAD THINGS HAPPEN (tm).
|
|
|
|
*/
|
|
|
|
if (IS_SCSI(isp) || mbp->param[0] == MBOX_INIT_FIRMWARE)
|
|
|
|
ISP_WRITE(isp, INMAILBOX5, mbp->param[5]);
|
|
|
|
mbp->param[5] = 0;
|
|
|
|
case 5:
|
|
|
|
if (IS_SCSI(isp) || mbp->param[0] == MBOX_INIT_FIRMWARE)
|
|
|
|
ISP_WRITE(isp, INMAILBOX4, mbp->param[4]);
|
|
|
|
mbp->param[4] = 0;
|
1998-04-22 17:54:58 +00:00
|
|
|
case 4: ISP_WRITE(isp, INMAILBOX3, mbp->param[3]); mbp->param[3] = 0;
|
|
|
|
case 3: ISP_WRITE(isp, INMAILBOX2, mbp->param[2]); mbp->param[2] = 0;
|
|
|
|
case 2: ISP_WRITE(isp, INMAILBOX1, mbp->param[1]); mbp->param[1] = 0;
|
|
|
|
case 1: ISP_WRITE(isp, INMAILBOX0, mbp->param[0]); mbp->param[0] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1999-03-17 05:04:39 +00:00
|
|
|
* Clear RISC int condition.
|
1998-04-22 17:54:58 +00:00
|
|
|
*/
|
1999-03-17 05:04:39 +00:00
|
|
|
ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT);
|
1998-04-22 17:54:58 +00:00
|
|
|
|
|
|
|
/*
|
1999-03-17 05:04:39 +00:00
|
|
|
* Clear semaphore on mailbox registers so that the Qlogic
|
|
|
|
* may update outgoing registers.
|
1998-04-22 17:54:58 +00:00
|
|
|
*/
|
1999-03-17 05:04:39 +00:00
|
|
|
ISP_WRITE(isp, BIU_SEMA, 0);
|
1998-04-22 17:54:58 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Set Host Interrupt condition so that RISC will pick up mailbox regs.
|
|
|
|
*/
|
|
|
|
ISP_WRITE(isp, HCCR, HCCR_CMD_SET_HOST_INT);
|
|
|
|
|
1999-03-17 05:04:39 +00:00
|
|
|
/*
|
|
|
|
* Wait until HOST INT has gone away (meaning that the Qlogic
|
|
|
|
* has picked up the mailbox command. Wait a long time.
|
|
|
|
*/
|
|
|
|
loops = MBOX_DELAY_COUNT * 5;
|
|
|
|
while ((ISP_READ(isp, HCCR) & HCCR_CMD_CLEAR_RISC_INT) != 0) {
|
|
|
|
SYS_DELAY(100);
|
|
|
|
if (--loops < 0) {
|
|
|
|
PRINTF("%s: isp_mboxcmd timeout #2\n", isp->isp_name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
1998-04-22 17:54:58 +00:00
|
|
|
|
|
|
|
/*
|
1999-03-17 05:04:39 +00:00
|
|
|
* While the Semaphore registers isn't set, wait for the Qlogic
|
|
|
|
* to process the mailbox command. Again- wait a long time.
|
1998-04-22 17:54:58 +00:00
|
|
|
*/
|
1999-03-17 05:04:39 +00:00
|
|
|
loops = MBOX_DELAY_COUNT * 5;
|
|
|
|
while ((ISP_READ(isp, BIU_SEMA) & 1) == 0) {
|
1998-04-22 17:54:58 +00:00
|
|
|
SYS_DELAY(100);
|
1999-03-17 05:04:39 +00:00
|
|
|
/*
|
|
|
|
* Wierd- I've seen the case where the semaphore register
|
|
|
|
* isn't getting set- sort of a violation of the protocol..
|
|
|
|
*/
|
|
|
|
if (ISP_READ(isp, OUTMAILBOX0) & 0x4000)
|
|
|
|
break;
|
1998-04-22 17:54:58 +00:00
|
|
|
if (--loops < 0) {
|
1999-03-17 05:04:39 +00:00
|
|
|
PRINTF("%s: isp_mboxcmd timeout #3\n", isp->isp_name);
|
1998-04-22 17:54:58 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-03-17 05:04:39 +00:00
|
|
|
/*
|
|
|
|
* Make sure that the MBOX_BUSY has gone away
|
|
|
|
*/
|
|
|
|
loops = MBOX_DELAY_COUNT;
|
|
|
|
for (;;) {
|
|
|
|
u_int16_t mbox = ISP_READ(isp, OUTMAILBOX0);
|
|
|
|
if (mbox == MBOX_BUSY) {
|
|
|
|
if (--loops < 0) {
|
|
|
|
PRINTF("%s: isp_mboxcmd timeout #4\n",
|
|
|
|
isp->isp_name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
SYS_DELAY(100);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* We have a pending MBOX async event.
|
|
|
|
*/
|
|
|
|
if (mbox & 0x8000) {
|
|
|
|
int fph = isp_parse_async(isp, (int) mbox);
|
|
|
|
ISP_WRITE(isp, BIU_SEMA, 0);
|
|
|
|
ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT);
|
|
|
|
if (fph < 0) {
|
|
|
|
return;
|
|
|
|
} else if (fph > 0) {
|
|
|
|
isp_fastpost_complete(isp, fph);
|
|
|
|
}
|
|
|
|
SYS_DELAY(100);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
1998-04-22 17:54:58 +00:00
|
|
|
|
|
|
|
/*
|
1999-05-11 05:06:55 +00:00
|
|
|
* Pick up output parameters. Special case some of the readbacks
|
|
|
|
* for the dual port SCSI cards.
|
1998-04-22 17:54:58 +00:00
|
|
|
*/
|
1999-12-16 05:42:02 +00:00
|
|
|
if (IS_DUALBUS(isp)) {
|
1999-05-11 05:06:55 +00:00
|
|
|
switch (opcode) {
|
|
|
|
case MBOX_GET_RETRY_COUNT:
|
|
|
|
case MBOX_SET_RETRY_COUNT:
|
|
|
|
mbp->param[7] = ISP_READ(isp, OUTMAILBOX7);
|
|
|
|
mbp->param[6] = ISP_READ(isp, OUTMAILBOX6);
|
|
|
|
break;
|
|
|
|
case MBOX_GET_TAG_AGE_LIMIT:
|
|
|
|
case MBOX_SET_TAG_AGE_LIMIT:
|
|
|
|
case MBOX_GET_ACT_NEG_STATE:
|
|
|
|
case MBOX_SET_ACT_NEG_STATE:
|
|
|
|
case MBOX_SET_ASYNC_DATA_SETUP_TIME:
|
|
|
|
case MBOX_GET_ASYNC_DATA_SETUP_TIME:
|
|
|
|
case MBOX_GET_RESET_DELAY_PARAMS:
|
|
|
|
case MBOX_SET_RESET_DELAY_PARAMS:
|
|
|
|
mbp->param[2] = ISP_READ(isp, OUTMAILBOX2);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-04-22 17:54:58 +00:00
|
|
|
switch (outparam) {
|
|
|
|
case 8: mbp->param[7] = ISP_READ(isp, OUTMAILBOX7);
|
|
|
|
case 7: mbp->param[6] = ISP_READ(isp, OUTMAILBOX6);
|
|
|
|
case 6: mbp->param[5] = ISP_READ(isp, OUTMAILBOX5);
|
|
|
|
case 5: mbp->param[4] = ISP_READ(isp, OUTMAILBOX4);
|
|
|
|
case 4: mbp->param[3] = ISP_READ(isp, OUTMAILBOX3);
|
|
|
|
case 3: mbp->param[2] = ISP_READ(isp, OUTMAILBOX2);
|
|
|
|
case 2: mbp->param[1] = ISP_READ(isp, OUTMAILBOX1);
|
|
|
|
case 1: mbp->param[0] = ISP_READ(isp, OUTMAILBOX0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Clear RISC int.
|
|
|
|
*/
|
|
|
|
ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Release semaphore on mailbox registers
|
|
|
|
*/
|
|
|
|
ISP_WRITE(isp, BIU_SEMA, 0);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Just to be chatty here...
|
|
|
|
*/
|
1999-03-25 22:52:45 +00:00
|
|
|
switch (mbp->param[0]) {
|
1998-04-22 17:54:58 +00:00
|
|
|
case MBOX_COMMAND_COMPLETE:
|
|
|
|
break;
|
|
|
|
case MBOX_INVALID_COMMAND:
|
1998-09-15 08:42:56 +00:00
|
|
|
IDPRINTF(2, ("%s: mbox cmd %x failed with INVALID_COMMAND\n",
|
|
|
|
isp->isp_name, opcode));
|
1998-04-22 17:54:58 +00:00
|
|
|
break;
|
|
|
|
case MBOX_HOST_INTERFACE_ERROR:
|
|
|
|
PRINTF("%s: mbox cmd %x failed with HOST_INTERFACE_ERROR\n",
|
1998-09-15 08:42:56 +00:00
|
|
|
isp->isp_name, opcode);
|
1998-04-22 17:54:58 +00:00
|
|
|
break;
|
|
|
|
case MBOX_TEST_FAILED:
|
|
|
|
PRINTF("%s: mbox cmd %x failed with TEST_FAILED\n",
|
1998-09-15 08:42:56 +00:00
|
|
|
isp->isp_name, opcode);
|
1998-04-22 17:54:58 +00:00
|
|
|
break;
|
|
|
|
case MBOX_COMMAND_ERROR:
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
if (opcode != MBOX_ABOUT_FIRMWARE)
|
|
|
|
PRINTF("%s: mbox cmd %x failed with COMMAND_ERROR\n",
|
|
|
|
isp->isp_name, opcode);
|
1998-04-22 17:54:58 +00:00
|
|
|
break;
|
|
|
|
case MBOX_COMMAND_PARAM_ERROR:
|
1999-03-17 05:04:39 +00:00
|
|
|
switch (opcode) {
|
|
|
|
case MBOX_GET_PORT_DB:
|
|
|
|
case MBOX_GET_PORT_NAME:
|
|
|
|
case MBOX_GET_DEV_QUEUE_PARAMS:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
PRINTF("%s: mbox cmd %x failed with "
|
|
|
|
"COMMAND_PARAM_ERROR\n", isp->isp_name, opcode);
|
|
|
|
}
|
1998-04-22 17:54:58 +00:00
|
|
|
break;
|
|
|
|
|
1998-12-05 01:33:57 +00:00
|
|
|
/*
|
|
|
|
* Be silent about these...
|
|
|
|
*/
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
case ASYNC_PDB_CHANGED:
|
|
|
|
((fcparam *) isp->isp_param)->isp_loopstate = LOOP_PDB_RCVD;
|
|
|
|
break;
|
1998-12-05 01:33:57 +00:00
|
|
|
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
case ASYNC_LIP_OCCURRED:
|
1999-10-17 18:58:22 +00:00
|
|
|
((fcparam *) isp->isp_param)->isp_lipseq = mbp->param[1];
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
case ASYNC_LOOP_UP:
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
((fcparam *) isp->isp_param)->isp_fwstate = FW_CONFIG_WAIT;
|
|
|
|
((fcparam *) isp->isp_param)->isp_loopstate = LOOP_LIP_RCVD;
|
|
|
|
break;
|
|
|
|
|
1999-03-17 05:04:39 +00:00
|
|
|
case ASYNC_LOOP_DOWN:
|
|
|
|
case ASYNC_LOOP_RESET:
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
((fcparam *) isp->isp_param)->isp_fwstate = FW_CONFIG_WAIT;
|
|
|
|
((fcparam *) isp->isp_param)->isp_loopstate = LOOP_NIL;
|
|
|
|
/* FALLTHROUGH */
|
1999-03-17 05:04:39 +00:00
|
|
|
case ASYNC_CHANGE_NOTIFY:
|
|
|
|
break;
|
1998-04-22 17:54:58 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
/*
|
|
|
|
* The expected return of EXEC_FIRMWARE is zero.
|
|
|
|
*/
|
|
|
|
if ((opcode == MBOX_EXEC_FIRMWARE && mbp->param[0] != 0) ||
|
|
|
|
(opcode != MBOX_EXEC_FIRMWARE)) {
|
|
|
|
PRINTF("%s: mbox cmd %x failed with error %x\n",
|
|
|
|
isp->isp_name, opcode, mbp->param[0]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
void
|
|
|
|
isp_lostcmd(isp, xs)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
ISP_SCSI_XFER_T *xs;
|
1998-04-22 17:54:58 +00:00
|
|
|
{
|
|
|
|
mbreg_t mbs;
|
|
|
|
|
|
|
|
mbs.param[0] = MBOX_GET_FIRMWARE_STATUS;
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
|
|
|
isp_dumpregs(isp, "couldn't GET FIRMWARE STATUS");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (mbs.param[1]) {
|
|
|
|
PRINTF("%s: %d commands on completion queue\n",
|
1999-03-25 22:52:45 +00:00
|
|
|
isp->isp_name, mbs.param[1]);
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
if (XS_NULL(xs))
|
|
|
|
return;
|
|
|
|
|
|
|
|
mbs.param[0] = MBOX_GET_DEV_QUEUE_STATUS;
|
1999-05-11 05:06:55 +00:00
|
|
|
mbs.param[1] = (XS_TGT(xs) << 8) | XS_LUN(xs); /* XXX: WHICH BUS? */
|
1998-04-22 17:54:58 +00:00
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
|
|
|
isp_dumpregs(isp, "couldn't GET DEVICE QUEUE STATUS");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
PRINTF("%s: lost command for target %d lun %d, %d active of %d, "
|
|
|
|
"Queue State: %x\n", isp->isp_name, XS_TGT(xs),
|
|
|
|
XS_LUN(xs), mbs.param[2], mbs.param[3], mbs.param[1]);
|
|
|
|
|
|
|
|
isp_dumpregs(isp, "lost command");
|
|
|
|
/*
|
|
|
|
* XXX: Need to try and do something to recover.
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-09-15 08:42:56 +00:00
|
|
|
isp_dumpregs(isp, msg)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
const char *msg;
|
1998-04-22 17:54:58 +00:00
|
|
|
{
|
|
|
|
PRINTF("%s: %s\n", isp->isp_name, msg);
|
1999-08-16 19:59:55 +00:00
|
|
|
if (IS_SCSI(isp))
|
1998-04-22 17:54:58 +00:00
|
|
|
PRINTF(" biu_conf1=%x", ISP_READ(isp, BIU_CONF1));
|
|
|
|
else
|
|
|
|
PRINTF(" biu_csr=%x", ISP_READ(isp, BIU2100_CSR));
|
|
|
|
PRINTF(" biu_icr=%x biu_isr=%x biu_sema=%x ", ISP_READ(isp, BIU_ICR),
|
1999-03-25 22:52:45 +00:00
|
|
|
ISP_READ(isp, BIU_ISR), ISP_READ(isp, BIU_SEMA));
|
1998-04-22 17:54:58 +00:00
|
|
|
PRINTF("risc_hccr=%x\n", ISP_READ(isp, HCCR));
|
|
|
|
|
1999-02-09 01:07:06 +00:00
|
|
|
|
1999-08-16 19:59:55 +00:00
|
|
|
if (IS_SCSI(isp)) {
|
1998-04-22 17:54:58 +00:00
|
|
|
ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE);
|
|
|
|
PRINTF(" cdma_conf=%x cdma_sts=%x cdma_fifostat=%x\n",
|
|
|
|
ISP_READ(isp, CDMA_CONF), ISP_READ(isp, CDMA_STATUS),
|
|
|
|
ISP_READ(isp, CDMA_FIFO_STS));
|
|
|
|
PRINTF(" ddma_conf=%x ddma_sts=%x ddma_fifostat=%x\n",
|
|
|
|
ISP_READ(isp, DDMA_CONF), ISP_READ(isp, DDMA_STATUS),
|
|
|
|
ISP_READ(isp, DDMA_FIFO_STS));
|
|
|
|
PRINTF(" sxp_int=%x sxp_gross=%x sxp(scsi_ctrl)=%x\n",
|
|
|
|
ISP_READ(isp, SXP_INTERRUPT),
|
|
|
|
ISP_READ(isp, SXP_GROSS_ERR),
|
1999-12-16 05:42:02 +00:00
|
|
|
ISP_READ(isp, SXP_PINS_CTRL));
|
1998-04-22 17:54:58 +00:00
|
|
|
ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE);
|
|
|
|
}
|
1999-02-09 01:07:06 +00:00
|
|
|
PRINTF(" mbox regs: %x %x %x %x %x\n",
|
|
|
|
ISP_READ(isp, OUTMAILBOX0), ISP_READ(isp, OUTMAILBOX1),
|
|
|
|
ISP_READ(isp, OUTMAILBOX2), ISP_READ(isp, OUTMAILBOX3),
|
|
|
|
ISP_READ(isp, OUTMAILBOX4));
|
1998-04-22 17:54:58 +00:00
|
|
|
ISP_DUMPREGS(isp);
|
|
|
|
}
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
static void
|
|
|
|
isp_fw_state(isp)
|
|
|
|
struct ispsoftc *isp;
|
1998-04-22 17:54:58 +00:00
|
|
|
{
|
|
|
|
mbreg_t mbs;
|
1999-08-16 19:59:55 +00:00
|
|
|
if (IS_FC(isp)) {
|
1998-04-22 17:54:58 +00:00
|
|
|
int once = 0;
|
|
|
|
fcparam *fcp = isp->isp_param;
|
|
|
|
again:
|
|
|
|
mbs.param[0] = MBOX_GET_FW_STATE;
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
1999-11-21 03:18:22 +00:00
|
|
|
IDPRINTF(1, ("%s: isp_fw_state 0x%x\n", isp->isp_name,
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
mbs.param[0]));
|
1999-03-17 05:04:39 +00:00
|
|
|
switch (mbs.param[0]) {
|
|
|
|
case ASYNC_PDB_CHANGED:
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
if (once++ < 10) {
|
|
|
|
goto again;
|
|
|
|
}
|
|
|
|
fcp->isp_fwstate = FW_CONFIG_WAIT;
|
|
|
|
fcp->isp_loopstate = LOOP_PDB_RCVD;
|
|
|
|
goto again;
|
|
|
|
case ASYNC_LIP_OCCURRED:
|
1999-10-17 18:58:22 +00:00
|
|
|
fcp->isp_lipseq = mbs.param[1];
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
case ASYNC_LOOP_UP:
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
fcp->isp_fwstate = FW_CONFIG_WAIT;
|
|
|
|
fcp->isp_loopstate = LOOP_LIP_RCVD;
|
|
|
|
if (once++ < 10) {
|
|
|
|
goto again;
|
|
|
|
}
|
|
|
|
break;
|
1999-03-17 05:04:39 +00:00
|
|
|
case ASYNC_LOOP_RESET:
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
case ASYNC_LOOP_DOWN:
|
|
|
|
fcp->isp_fwstate = FW_CONFIG_WAIT;
|
|
|
|
fcp->isp_loopstate = LOOP_NIL;
|
|
|
|
/* FALLTHROUGH */
|
1999-03-17 05:04:39 +00:00
|
|
|
case ASYNC_CHANGE_NOTIFY:
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
if (once++ < 10) {
|
1998-04-22 17:54:58 +00:00
|
|
|
goto again;
|
|
|
|
}
|
1999-03-17 05:04:39 +00:00
|
|
|
break;
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
PRINTF("%s: GET FIRMWARE STATE failed (0x%x)\n",
|
|
|
|
isp->isp_name, mbs.param[0]);
|
1998-04-22 17:54:58 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
fcp->isp_fwstate = mbs.param[1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-09-15 08:42:56 +00:00
|
|
|
isp_update(isp)
|
|
|
|
struct ispsoftc *isp;
|
1999-05-11 05:06:55 +00:00
|
|
|
{
|
|
|
|
int bus;
|
|
|
|
|
|
|
|
for (bus = 0; isp->isp_update != 0; bus++) {
|
|
|
|
if (isp->isp_update & (1 << bus)) {
|
|
|
|
isp_update_bus(isp, bus);
|
|
|
|
isp->isp_update ^= (1 << bus);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
isp_update_bus(isp, bus)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
int bus;
|
1998-04-22 17:54:58 +00:00
|
|
|
{
|
1998-09-15 08:42:56 +00:00
|
|
|
int tgt;
|
1998-04-22 17:54:58 +00:00
|
|
|
mbreg_t mbs;
|
|
|
|
sdparam *sdp;
|
|
|
|
|
1999-08-16 19:59:55 +00:00
|
|
|
if (IS_FC(isp)) {
|
1998-04-22 17:54:58 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
sdp = isp->isp_param;
|
1999-05-11 05:06:55 +00:00
|
|
|
sdp += bus;
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
|
1999-05-11 05:06:55 +00:00
|
|
|
u_int16_t flags, period, offset;
|
1999-01-30 07:29:00 +00:00
|
|
|
int get;
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
if (sdp->isp_devparam[tgt].dev_enable == 0) {
|
1999-08-16 19:59:55 +00:00
|
|
|
IDPRINTF(1, ("%s: skipping target %d bus %d update\n",
|
|
|
|
isp->isp_name, tgt, bus));
|
1998-09-15 08:42:56 +00:00
|
|
|
continue;
|
|
|
|
}
|
1999-01-30 07:29:00 +00:00
|
|
|
|
1999-03-25 22:52:45 +00:00
|
|
|
/*
|
|
|
|
* If the goal is to update the status of the device,
|
|
|
|
* take what's in dev_flags and try and set the device
|
|
|
|
* toward that. Otherwise, if we're just refreshing the
|
|
|
|
* current device state, get the current parameters.
|
|
|
|
*/
|
1999-01-30 07:29:00 +00:00
|
|
|
if (sdp->isp_devparam[tgt].dev_update) {
|
|
|
|
mbs.param[0] = MBOX_SET_TARGET_PARAMS;
|
|
|
|
mbs.param[2] = sdp->isp_devparam[tgt].dev_flags;
|
1999-05-11 05:06:55 +00:00
|
|
|
/*
|
|
|
|
* Insist that PARITY must be enabled if SYNC
|
|
|
|
* is enabled.
|
|
|
|
*/
|
|
|
|
if (mbs.param[2] & DPARM_SYNC) {
|
|
|
|
mbs.param[2] |= DPARM_PARITY;
|
|
|
|
}
|
1999-01-30 07:29:00 +00:00
|
|
|
mbs.param[3] =
|
|
|
|
(sdp->isp_devparam[tgt].sync_offset << 8) |
|
|
|
|
(sdp->isp_devparam[tgt].sync_period);
|
|
|
|
sdp->isp_devparam[tgt].dev_update = 0;
|
1999-03-25 22:52:45 +00:00
|
|
|
/*
|
|
|
|
* A command completion later that has
|
|
|
|
* RQSTF_NEGOTIATION set will cause
|
|
|
|
* the dev_refresh/announce cycle.
|
|
|
|
*
|
|
|
|
* Note: It is really important to update our current
|
|
|
|
* flags with at least the state of TAG capabilities-
|
|
|
|
* otherwise we might try and send a tagged command
|
|
|
|
* when we have it all turned off. So change it here
|
|
|
|
* to say that current already matches goal.
|
|
|
|
*/
|
|
|
|
sdp->isp_devparam[tgt].cur_dflags &= ~DPARM_TQING;
|
|
|
|
sdp->isp_devparam[tgt].cur_dflags |=
|
|
|
|
(sdp->isp_devparam[tgt].dev_flags & DPARM_TQING);
|
1999-05-11 05:06:55 +00:00
|
|
|
sdp->isp_devparam[tgt].dev_refresh = 1;
|
1999-05-12 18:56:55 +00:00
|
|
|
IDPRINTF(3, ("%s: bus %d set tgt %d flags 0x%x off 0x%x"
|
|
|
|
" period 0x%x\n", isp->isp_name, bus, tgt,
|
|
|
|
mbs.param[2], mbs.param[3] >> 8,
|
|
|
|
mbs.param[3] & 0xff));
|
1999-01-30 07:29:00 +00:00
|
|
|
get = 0;
|
|
|
|
} else if (sdp->isp_devparam[tgt].dev_refresh) {
|
|
|
|
mbs.param[0] = MBOX_GET_TARGET_PARAMS;
|
|
|
|
sdp->isp_devparam[tgt].dev_refresh = 0;
|
|
|
|
get = 1;
|
|
|
|
} else {
|
1998-09-15 08:42:56 +00:00
|
|
|
continue;
|
|
|
|
}
|
1999-05-11 05:06:55 +00:00
|
|
|
mbs.param[1] = (bus << 15) | (tgt << 8) ;
|
1998-09-15 08:42:56 +00:00
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
1999-01-30 07:29:00 +00:00
|
|
|
PRINTF("%s: failed to %cet SCSI parameters for "
|
|
|
|
"target %d\n", isp->isp_name, (get)? 'g' : 's',
|
|
|
|
tgt);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (get == 0) {
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_sendmarker |= (1 << bus);
|
1999-01-30 07:29:00 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
flags = mbs.param[2];
|
|
|
|
period = mbs.param[3] & 0xff;
|
|
|
|
offset = mbs.param[3] >> 8;
|
|
|
|
sdp->isp_devparam[tgt].cur_dflags = flags;
|
1999-03-25 22:52:45 +00:00
|
|
|
sdp->isp_devparam[tgt].cur_period = period;
|
|
|
|
sdp->isp_devparam[tgt].cur_offset = offset;
|
1999-05-11 05:06:55 +00:00
|
|
|
get = (bus << 16) | tgt;
|
|
|
|
(void) isp_async(isp, ISPASYNC_NEW_TGT_PARAMS, &get);
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
1998-04-22 17:54:58 +00:00
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
static void
|
1999-05-11 05:06:55 +00:00
|
|
|
isp_setdfltparm(isp, channel)
|
1998-09-15 08:42:56 +00:00
|
|
|
struct ispsoftc *isp;
|
1999-05-11 05:06:55 +00:00
|
|
|
int channel;
|
1998-09-15 08:42:56 +00:00
|
|
|
{
|
1999-03-25 22:52:45 +00:00
|
|
|
int tgt;
|
1998-09-15 08:42:56 +00:00
|
|
|
mbreg_t mbs;
|
1999-12-20 01:34:01 +00:00
|
|
|
sdparam *sdp;
|
1998-04-22 17:54:58 +00:00
|
|
|
|
1999-03-17 05:04:39 +00:00
|
|
|
if (IS_FC(isp)) {
|
1998-09-15 08:42:56 +00:00
|
|
|
fcparam *fcp = (fcparam *) isp->isp_param;
|
1999-05-11 05:06:55 +00:00
|
|
|
fcp += channel;
|
|
|
|
if (fcp->isp_gotdparms) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
fcp->isp_gotdparms = 1;
|
1998-09-15 08:42:56 +00:00
|
|
|
fcp->isp_maxfrmlen = ICB_DFLT_FRMLEN;
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
fcp->isp_maxalloc = ICB_DFLT_ALLOC;
|
|
|
|
fcp->isp_execthrottle = ICB_DFLT_THROTTLE;
|
|
|
|
fcp->isp_retry_delay = ICB_DFLT_RDELAY;
|
|
|
|
fcp->isp_retry_count = ICB_DFLT_RCOUNT;
|
|
|
|
/* Platform specific.... */
|
|
|
|
fcp->isp_loopid = DEFAULT_LOOPID(isp);
|
|
|
|
fcp->isp_nodewwn = DEFAULT_WWN(isp);
|
1999-11-21 03:18:22 +00:00
|
|
|
fcp->isp_portwwn = 0;
|
1998-09-15 08:42:56 +00:00
|
|
|
/*
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
* Now try and read NVRAM
|
1998-09-15 08:42:56 +00:00
|
|
|
*/
|
1999-11-21 03:18:22 +00:00
|
|
|
if ((isp->isp_confopts & (ISP_CFG_NONVRAM|ISP_CFG_OWNWWN)) ||
|
|
|
|
(isp_read_nvram(isp))) {
|
|
|
|
PRINTF("%s: using Node WWN 0x%08x%08x\n",
|
|
|
|
isp->isp_name, (u_int32_t)(fcp->isp_nodewwn >> 32),
|
|
|
|
(u_int32_t)(fcp->isp_nodewwn & 0xffffffff));
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
}
|
1998-09-15 08:42:56 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-12-20 01:34:01 +00:00
|
|
|
sdp = (sdparam *) isp->isp_param;
|
|
|
|
sdp += channel;
|
1999-05-11 05:06:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Been there, done that, got the T-shirt...
|
|
|
|
*/
|
|
|
|
if (sdp->isp_gotdparms) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sdp->isp_gotdparms = 1;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If we've not been told to avoid reading NVRAM, try and read it.
|
|
|
|
* If we're successful reading it, we can return since NVRAM will
|
|
|
|
* tell us the right thing to do. Otherwise, establish some reasonable
|
|
|
|
* defaults.
|
|
|
|
*/
|
|
|
|
if ((isp->isp_confopts & ISP_CFG_NONVRAM) == 0) {
|
|
|
|
if (isp_read_nvram(isp) == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Now try and see whether we have specific values for them.
|
|
|
|
*/
|
1999-12-20 01:34:01 +00:00
|
|
|
if ((isp->isp_confopts & ISP_CFG_NONVRAM) == 0) {
|
|
|
|
mbs.param[0] = MBOX_GET_ACT_NEG_STATE;
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
|
|
|
IDPRINTF(2, ("could not GET ACT NEG STATE\n"));
|
|
|
|
sdp->isp_req_ack_active_neg = 1;
|
|
|
|
sdp->isp_data_line_active_neg = 1;
|
|
|
|
} else {
|
|
|
|
sdp->isp_req_ack_active_neg =
|
|
|
|
(mbs.param[1+channel] >> 4) & 0x1;
|
|
|
|
sdp->isp_data_line_active_neg =
|
|
|
|
(mbs.param[1+channel] >> 5) & 0x1;
|
1999-05-11 05:06:55 +00:00
|
|
|
}
|
1998-04-22 17:54:58 +00:00
|
|
|
} else {
|
1999-12-20 01:34:01 +00:00
|
|
|
sdp->isp_req_ack_active_neg = 1;
|
|
|
|
sdp->isp_data_line_active_neg = 1;
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
1999-02-09 01:07:06 +00:00
|
|
|
|
1999-12-20 01:34:01 +00:00
|
|
|
IDPRINTF(3, ("%s: defaulting bus %d REQ/ACK Active Negation is %d\n",
|
|
|
|
isp->isp_name, channel, sdp->isp_req_ack_active_neg));
|
|
|
|
IDPRINTF(3, ("%s: defaulting bus %d DATA Active Negation is %d\n",
|
|
|
|
isp->isp_name, channel, sdp->isp_data_line_active_neg));
|
|
|
|
|
1999-03-25 22:52:45 +00:00
|
|
|
/*
|
|
|
|
* The trick here is to establish a default for the default (honk!)
|
|
|
|
* state (dev_flags). Then try and get the current status from
|
|
|
|
* the card to fill in the current state. We don't, in fact, set
|
|
|
|
* the default to the SAFE default state- that's not the goal state.
|
|
|
|
*/
|
|
|
|
for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
|
|
|
|
sdp->isp_devparam[tgt].cur_offset = 0;
|
|
|
|
sdp->isp_devparam[tgt].cur_period = 0;
|
|
|
|
sdp->isp_devparam[tgt].dev_flags = DPARM_DEFAULT;
|
|
|
|
sdp->isp_devparam[tgt].cur_dflags = 0;
|
1999-02-09 01:07:06 +00:00
|
|
|
if (isp->isp_type < ISP_HA_SCSI_1040 ||
|
1999-05-11 05:06:55 +00:00
|
|
|
(isp->isp_clock && isp->isp_clock < 60)) {
|
1999-03-25 22:52:45 +00:00
|
|
|
sdp->isp_devparam[tgt].sync_offset =
|
1999-02-09 01:07:06 +00:00
|
|
|
ISP_10M_SYNCPARMS >> 8;
|
1999-03-25 22:52:45 +00:00
|
|
|
sdp->isp_devparam[tgt].sync_period =
|
1999-02-09 01:07:06 +00:00
|
|
|
ISP_10M_SYNCPARMS & 0xff;
|
1999-12-16 05:42:02 +00:00
|
|
|
} else if (IS_ULTRA2(isp)) {
|
1999-03-25 22:52:45 +00:00
|
|
|
sdp->isp_devparam[tgt].sync_offset =
|
|
|
|
ISP_40M_SYNCPARMS >> 8;
|
|
|
|
sdp->isp_devparam[tgt].sync_period =
|
|
|
|
ISP_40M_SYNCPARMS & 0xff;
|
1999-02-09 01:07:06 +00:00
|
|
|
} else {
|
1999-03-25 22:52:45 +00:00
|
|
|
sdp->isp_devparam[tgt].sync_offset =
|
1999-02-09 01:07:06 +00:00
|
|
|
ISP_20M_SYNCPARMS >> 8;
|
1999-03-25 22:52:45 +00:00
|
|
|
sdp->isp_devparam[tgt].sync_period =
|
1999-02-09 01:07:06 +00:00
|
|
|
ISP_20M_SYNCPARMS & 0xff;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Don't get current target parameters if we've been
|
|
|
|
* told not to use NVRAM- it's really the same thing.
|
|
|
|
*/
|
1999-12-20 01:34:01 +00:00
|
|
|
if ((isp->isp_confopts & ISP_CFG_NONVRAM) == 0) {
|
1998-09-15 08:42:56 +00:00
|
|
|
|
1999-12-20 01:34:01 +00:00
|
|
|
mbs.param[0] = MBOX_GET_TARGET_PARAMS;
|
|
|
|
mbs.param[1] = tgt << 8;
|
|
|
|
isp_mboxcmd(isp, &mbs);
|
|
|
|
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
sdp->isp_devparam[tgt].cur_dflags = mbs.param[2];
|
|
|
|
sdp->isp_devparam[tgt].dev_flags = mbs.param[2];
|
|
|
|
sdp->isp_devparam[tgt].cur_period = mbs.param[3] & 0xff;
|
|
|
|
sdp->isp_devparam[tgt].cur_offset = mbs.param[3] >> 8;
|
1999-03-25 22:52:45 +00:00
|
|
|
|
1999-12-20 01:34:01 +00:00
|
|
|
/*
|
|
|
|
* The maximum period we can really see
|
|
|
|
* here is 100 (decimal), or 400 ns.
|
|
|
|
* For some unknown reason we sometimes
|
|
|
|
* get back wildass numbers from the
|
|
|
|
* boot device's parameters (alpha only).
|
|
|
|
*/
|
|
|
|
if ((mbs.param[3] & 0xff) <= 0x64) {
|
|
|
|
sdp->isp_devparam[tgt].sync_period =
|
|
|
|
mbs.param[3] & 0xff;
|
|
|
|
sdp->isp_devparam[tgt].sync_offset =
|
|
|
|
mbs.param[3] >> 8;
|
|
|
|
}
|
1998-09-15 08:42:56 +00:00
|
|
|
|
1999-12-20 01:34:01 +00:00
|
|
|
/*
|
|
|
|
* It is not safe to run Ultra Mode with a clock < 60.
|
|
|
|
*/
|
|
|
|
if (((isp->isp_clock && isp->isp_clock < 60) ||
|
|
|
|
(isp->isp_type < ISP_HA_SCSI_1020A)) &&
|
|
|
|
(sdp->isp_devparam[tgt].sync_period <=
|
|
|
|
(ISP_20M_SYNCPARMS & 0xff))) {
|
|
|
|
sdp->isp_devparam[tgt].sync_offset =
|
|
|
|
ISP_10M_SYNCPARMS >> 8;
|
|
|
|
sdp->isp_devparam[tgt].sync_period =
|
|
|
|
ISP_10M_SYNCPARMS & 0xff;
|
|
|
|
}
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
1999-12-20 01:34:01 +00:00
|
|
|
IDPRINTF(3, ("%s: bus %d tgt %d flags %x offset %x period %x\n",
|
|
|
|
isp->isp_name, channel, tgt,
|
|
|
|
sdp->isp_devparam[tgt].dev_flags,
|
|
|
|
sdp->isp_devparam[tgt].sync_period,
|
|
|
|
sdp->isp_devparam[tgt].sync_period));
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1999-05-11 05:06:55 +00:00
|
|
|
* Establish default some more default parameters.
|
1998-04-22 17:54:58 +00:00
|
|
|
*/
|
|
|
|
sdp->isp_cmd_dma_burst_enable = 1;
|
|
|
|
sdp->isp_data_dma_burst_enabl = 1;
|
1998-09-15 08:42:56 +00:00
|
|
|
sdp->isp_fifo_threshold = 0;
|
1998-04-22 17:54:58 +00:00
|
|
|
sdp->isp_initiator_id = 7;
|
1999-05-11 05:06:55 +00:00
|
|
|
/* XXXX This is probably based upon clock XXXX */
|
1998-09-15 08:42:56 +00:00
|
|
|
if (isp->isp_type >= ISP_HA_SCSI_1040) {
|
|
|
|
sdp->isp_async_data_setup = 9;
|
|
|
|
} else {
|
|
|
|
sdp->isp_async_data_setup = 6;
|
|
|
|
}
|
1998-04-22 17:54:58 +00:00
|
|
|
sdp->isp_selection_timeout = 250;
|
1999-04-14 17:37:36 +00:00
|
|
|
sdp->isp_max_queue_depth = MAXISPREQUEST;
|
1998-04-22 17:54:58 +00:00
|
|
|
sdp->isp_tag_aging = 8;
|
|
|
|
sdp->isp_bus_reset_delay = 3;
|
1999-05-11 05:06:55 +00:00
|
|
|
sdp->isp_retry_count = 2;
|
|
|
|
sdp->isp_retry_delay = 2;
|
1998-04-22 17:54:58 +00:00
|
|
|
|
1999-03-25 22:52:45 +00:00
|
|
|
for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
|
|
|
|
sdp->isp_devparam[tgt].exc_throttle = 16;
|
|
|
|
sdp->isp_devparam[tgt].dev_enable = 1;
|
1998-04-22 17:54:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-03-25 22:52:45 +00:00
|
|
|
/*
|
1998-09-15 08:42:56 +00:00
|
|
|
* Re-initialize the ISP and complete all orphaned commands
|
1999-10-17 18:58:22 +00:00
|
|
|
* with a 'botched' notice. The reset/init routines should
|
|
|
|
* not disturb an already active list of commands.
|
1998-09-15 08:42:56 +00:00
|
|
|
*
|
|
|
|
* Locks held prior to coming here.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
|
|
|
isp_restart(isp)
|
|
|
|
struct ispsoftc *isp;
|
1998-04-22 17:54:58 +00:00
|
|
|
{
|
1999-10-17 18:58:22 +00:00
|
|
|
ISP_SCSI_XFER_T *xs;
|
|
|
|
u_int32_t handle;
|
1998-04-22 17:54:58 +00:00
|
|
|
|
1999-05-11 05:06:55 +00:00
|
|
|
#if 0
|
1999-04-04 02:28:29 +00:00
|
|
|
isp->isp_gotdparms = 0;
|
1999-05-11 05:06:55 +00:00
|
|
|
#endif
|
1998-04-22 17:54:58 +00:00
|
|
|
isp_reset(isp);
|
1998-09-15 08:42:56 +00:00
|
|
|
if (isp->isp_state == ISP_RESETSTATE) {
|
|
|
|
isp_init(isp);
|
|
|
|
if (isp->isp_state == ISP_INITSTATE) {
|
|
|
|
isp->isp_state = ISP_RUNSTATE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (isp->isp_state != ISP_RUNSTATE) {
|
|
|
|
PRINTF("%s: isp_restart cannot restart ISP\n", isp->isp_name);
|
|
|
|
}
|
1999-10-17 18:58:22 +00:00
|
|
|
isp->isp_nactive = 0;
|
1998-04-22 17:54:58 +00:00
|
|
|
|
1999-10-17 18:58:22 +00:00
|
|
|
for (handle = 1; handle <= (int) isp->isp_maxcmds; handle++) {
|
|
|
|
xs = isp_find_xs(isp, handle);
|
|
|
|
if (xs == NULL) {
|
1998-04-22 17:54:58 +00:00
|
|
|
continue;
|
1998-09-17 21:03:45 +00:00
|
|
|
}
|
1999-10-17 18:58:22 +00:00
|
|
|
isp_destroy_handle(isp, handle);
|
|
|
|
if (XS_XFRLEN(xs)) {
|
|
|
|
ISP_DMAFREE(isp, xs, handle);
|
|
|
|
XS_RESID(xs) = XS_XFRLEN(xs);
|
|
|
|
} else {
|
|
|
|
XS_RESID(xs) = 0;
|
|
|
|
}
|
1998-09-15 08:42:56 +00:00
|
|
|
XS_SETERR(xs, HBA_BUSRESET);
|
1998-04-22 17:54:58 +00:00
|
|
|
XS_CMD_DONE(xs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
/*
|
|
|
|
* NVRAM Routines
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int
|
|
|
|
isp_read_nvram(isp)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
{
|
1999-05-11 05:06:55 +00:00
|
|
|
static char *tru = "true";
|
|
|
|
static char *not = "false";
|
1998-09-15 08:42:56 +00:00
|
|
|
int i, amt;
|
|
|
|
u_int8_t csum, minversion;
|
|
|
|
union {
|
|
|
|
u_int8_t _x[ISP2100_NVRAM_SIZE];
|
|
|
|
u_int16_t _s[ISP2100_NVRAM_SIZE>>1];
|
|
|
|
} _n;
|
|
|
|
#define nvram_data _n._x
|
|
|
|
#define nvram_words _n._s
|
|
|
|
|
1999-03-17 05:04:39 +00:00
|
|
|
if (IS_FC(isp)) {
|
1998-09-15 08:42:56 +00:00
|
|
|
amt = ISP2100_NVRAM_SIZE;
|
|
|
|
minversion = 1;
|
1999-12-16 05:42:02 +00:00
|
|
|
} else if (IS_ULTRA2(isp)) {
|
1999-05-11 05:06:55 +00:00
|
|
|
amt = ISP1080_NVRAM_SIZE;
|
|
|
|
minversion = 0;
|
1998-09-15 08:42:56 +00:00
|
|
|
} else {
|
|
|
|
amt = ISP_NVRAM_SIZE;
|
|
|
|
minversion = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Just read the first two words first to see if we have a valid
|
|
|
|
* NVRAM to continue reading the rest with.
|
|
|
|
*/
|
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
isp_rdnvram_word(isp, i, &nvram_words[i]);
|
|
|
|
}
|
|
|
|
if (nvram_data[0] != 'I' || nvram_data[1] != 'S' ||
|
|
|
|
nvram_data[2] != 'P') {
|
|
|
|
if (isp->isp_bustype != ISP_BT_SBUS) {
|
1999-05-11 05:06:55 +00:00
|
|
|
PRINTF("%s: invalid NVRAM header (%x,%x,%x,%x)\n",
|
|
|
|
isp->isp_name, nvram_data[0], nvram_data[1],
|
|
|
|
nvram_data[2], nvram_data[3]);
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
for (i = 2; i < amt>>1; i++) {
|
|
|
|
isp_rdnvram_word(isp, i, &nvram_words[i]);
|
|
|
|
}
|
|
|
|
for (csum = 0, i = 0; i < amt; i++) {
|
|
|
|
csum += nvram_data[i];
|
|
|
|
}
|
|
|
|
if (csum != 0) {
|
|
|
|
PRINTF("%s: invalid NVRAM checksum\n", isp->isp_name);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
if (ISP_NVRAM_VERSION(nvram_data) < minversion) {
|
|
|
|
PRINTF("%s: version %d NVRAM not understood\n", isp->isp_name,
|
|
|
|
ISP_NVRAM_VERSION(nvram_data));
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
1999-12-16 05:42:02 +00:00
|
|
|
if (IS_ULTRA2(isp)) {
|
1999-05-11 05:06:55 +00:00
|
|
|
int bus;
|
|
|
|
sdparam *sdp = (sdparam *) isp->isp_param;
|
1999-12-16 05:42:02 +00:00
|
|
|
for (bus = 0; bus < (IS_DUALBUS(isp)? 2 : 1); bus++, sdp++) {
|
1999-05-11 05:06:55 +00:00
|
|
|
sdp->isp_fifo_threshold =
|
|
|
|
ISP1080_NVRAM_FIFO_THRESHOLD(nvram_data);
|
|
|
|
|
|
|
|
sdp->isp_initiator_id =
|
|
|
|
ISP1080_NVRAM_INITIATOR_ID(nvram_data, bus);
|
|
|
|
|
|
|
|
sdp->isp_bus_reset_delay =
|
|
|
|
ISP1080_NVRAM_BUS_RESET_DELAY(nvram_data, bus);
|
|
|
|
|
|
|
|
sdp->isp_retry_count =
|
|
|
|
ISP1080_NVRAM_BUS_RETRY_COUNT(nvram_data, bus);
|
|
|
|
|
|
|
|
sdp->isp_retry_delay =
|
|
|
|
ISP1080_NVRAM_BUS_RETRY_DELAY(nvram_data, bus);
|
|
|
|
|
|
|
|
sdp->isp_async_data_setup =
|
|
|
|
ISP1080_NVRAM_ASYNC_DATA_SETUP_TIME(nvram_data,
|
|
|
|
bus);
|
|
|
|
|
|
|
|
sdp->isp_req_ack_active_neg =
|
|
|
|
ISP1080_NVRAM_REQ_ACK_ACTIVE_NEGATION(nvram_data,
|
|
|
|
bus);
|
|
|
|
|
|
|
|
sdp->isp_data_line_active_neg =
|
|
|
|
ISP1080_NVRAM_DATA_LINE_ACTIVE_NEGATION(nvram_data,
|
|
|
|
bus);
|
|
|
|
|
|
|
|
sdp->isp_data_dma_burst_enabl =
|
|
|
|
ISP1080_NVRAM_BURST_ENABLE(nvram_data);
|
|
|
|
|
|
|
|
sdp->isp_cmd_dma_burst_enable =
|
|
|
|
ISP1080_NVRAM_BURST_ENABLE(nvram_data);
|
|
|
|
|
|
|
|
sdp->isp_selection_timeout =
|
|
|
|
ISP1080_NVRAM_SELECTION_TIMEOUT(nvram_data, bus);
|
|
|
|
|
|
|
|
sdp->isp_max_queue_depth =
|
|
|
|
ISP1080_NVRAM_MAX_QUEUE_DEPTH(nvram_data, bus);
|
|
|
|
|
|
|
|
if (isp->isp_dblev >= 3) {
|
|
|
|
PRINTF("%s: ISP1080 bus %d NVRAM values:\n",
|
|
|
|
isp->isp_name, bus);
|
|
|
|
PRINTF(" Initiator ID = %d\n",
|
|
|
|
sdp->isp_initiator_id);
|
|
|
|
PRINTF(" Fifo Threshold = 0x%x\n",
|
|
|
|
sdp->isp_fifo_threshold);
|
|
|
|
PRINTF(" Bus Reset Delay = %d\n",
|
|
|
|
sdp->isp_bus_reset_delay);
|
|
|
|
PRINTF(" Retry Count = %d\n",
|
|
|
|
sdp->isp_retry_count);
|
|
|
|
PRINTF(" Retry Delay = %d\n",
|
|
|
|
sdp->isp_retry_delay);
|
|
|
|
PRINTF(" Tag Age Limit = %d\n",
|
|
|
|
sdp->isp_tag_aging);
|
|
|
|
PRINTF(" Selection Timeout = %d\n",
|
|
|
|
sdp->isp_selection_timeout);
|
|
|
|
PRINTF(" Max Queue Depth = %d\n",
|
|
|
|
sdp->isp_max_queue_depth);
|
|
|
|
PRINTF(" Async Data Setup = 0x%x\n",
|
|
|
|
sdp->isp_async_data_setup);
|
|
|
|
PRINTF(" REQ/ACK Active Negation = %s\n",
|
|
|
|
sdp->isp_req_ack_active_neg? tru : not);
|
|
|
|
PRINTF(" Data Line Active Negation = %s\n",
|
|
|
|
sdp->isp_data_line_active_neg? tru : not);
|
|
|
|
PRINTF(" Cmd DMA Burst Enable = %s\n",
|
|
|
|
sdp->isp_cmd_dma_burst_enable? tru : not);
|
|
|
|
}
|
|
|
|
for (i = 0; i < MAX_TARGETS; i++) {
|
|
|
|
sdp->isp_devparam[i].dev_enable =
|
|
|
|
ISP1080_NVRAM_TGT_DEVICE_ENABLE(nvram_data, i, bus);
|
|
|
|
sdp->isp_devparam[i].exc_throttle =
|
|
|
|
ISP1080_NVRAM_TGT_EXEC_THROTTLE(nvram_data, i, bus);
|
|
|
|
sdp->isp_devparam[i].sync_offset =
|
|
|
|
ISP1080_NVRAM_TGT_SYNC_OFFSET(nvram_data, i, bus);
|
|
|
|
sdp->isp_devparam[i].sync_period =
|
|
|
|
ISP1080_NVRAM_TGT_SYNC_PERIOD(nvram_data, i, bus);
|
|
|
|
sdp->isp_devparam[i].dev_flags = 0;
|
|
|
|
if (ISP1080_NVRAM_TGT_RENEG(nvram_data, i, bus))
|
|
|
|
sdp->isp_devparam[i].dev_flags |= DPARM_RENEG;
|
|
|
|
if (ISP1080_NVRAM_TGT_QFRZ(nvram_data, i, bus)) {
|
|
|
|
PRINTF("%s: not supporting QFRZ option "
|
|
|
|
"for target %d bus %d\n",
|
|
|
|
isp->isp_name, i, bus);
|
|
|
|
}
|
|
|
|
sdp->isp_devparam[i].dev_flags |= DPARM_ARQ;
|
|
|
|
if (ISP1080_NVRAM_TGT_ARQ(nvram_data, i, bus) == 0) {
|
|
|
|
PRINTF("%s: not disabling ARQ option "
|
|
|
|
"for target %d bus %d\n",
|
|
|
|
isp->isp_name, i, bus);
|
|
|
|
}
|
|
|
|
if (ISP1080_NVRAM_TGT_TQING(nvram_data, i, bus))
|
|
|
|
sdp->isp_devparam[i].dev_flags |= DPARM_TQING;
|
|
|
|
if (ISP1080_NVRAM_TGT_SYNC(nvram_data, i, bus))
|
|
|
|
sdp->isp_devparam[i].dev_flags |= DPARM_SYNC;
|
|
|
|
if (ISP1080_NVRAM_TGT_WIDE(nvram_data, i, bus))
|
|
|
|
sdp->isp_devparam[i].dev_flags |= DPARM_WIDE;
|
|
|
|
if (ISP1080_NVRAM_TGT_PARITY(nvram_data, i, bus))
|
|
|
|
sdp->isp_devparam[i].dev_flags |= DPARM_PARITY;
|
|
|
|
if (ISP1080_NVRAM_TGT_DISC(nvram_data, i, bus))
|
|
|
|
sdp->isp_devparam[i].dev_flags |= DPARM_DISC;
|
|
|
|
sdp->isp_devparam[i].cur_dflags = 0;
|
|
|
|
if (isp->isp_dblev >= 3) {
|
|
|
|
PRINTF(" Target %d: Ena %d Throttle "
|
|
|
|
"%d Offset %d Period %d Flags "
|
|
|
|
"0x%x\n", i,
|
|
|
|
sdp->isp_devparam[i].dev_enable,
|
|
|
|
sdp->isp_devparam[i].exc_throttle,
|
|
|
|
sdp->isp_devparam[i].sync_offset,
|
|
|
|
sdp->isp_devparam[i].sync_period,
|
|
|
|
sdp->isp_devparam[i].dev_flags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (IS_SCSI(isp)) {
|
1998-09-15 08:42:56 +00:00
|
|
|
sdparam *sdp = (sdparam *) isp->isp_param;
|
|
|
|
|
|
|
|
sdp->isp_fifo_threshold =
|
1999-01-10 02:55:10 +00:00
|
|
|
ISP_NVRAM_FIFO_THRESHOLD(nvram_data) |
|
|
|
|
(ISP_NVRAM_FIFO_THRESHOLD_128(nvram_data) << 2);
|
1998-09-15 08:42:56 +00:00
|
|
|
|
|
|
|
sdp->isp_initiator_id =
|
|
|
|
ISP_NVRAM_INITIATOR_ID(nvram_data);
|
|
|
|
|
|
|
|
sdp->isp_bus_reset_delay =
|
|
|
|
ISP_NVRAM_BUS_RESET_DELAY(nvram_data);
|
|
|
|
|
|
|
|
sdp->isp_retry_count =
|
|
|
|
ISP_NVRAM_BUS_RETRY_COUNT(nvram_data);
|
|
|
|
|
|
|
|
sdp->isp_retry_delay =
|
|
|
|
ISP_NVRAM_BUS_RETRY_DELAY(nvram_data);
|
|
|
|
|
|
|
|
sdp->isp_async_data_setup =
|
|
|
|
ISP_NVRAM_ASYNC_DATA_SETUP_TIME(nvram_data);
|
|
|
|
|
|
|
|
if (isp->isp_type >= ISP_HA_SCSI_1040) {
|
|
|
|
if (sdp->isp_async_data_setup < 9) {
|
|
|
|
sdp->isp_async_data_setup = 9;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (sdp->isp_async_data_setup != 6) {
|
|
|
|
sdp->isp_async_data_setup = 6;
|
|
|
|
}
|
|
|
|
}
|
1999-03-25 22:52:45 +00:00
|
|
|
|
1998-09-15 08:42:56 +00:00
|
|
|
sdp->isp_req_ack_active_neg =
|
|
|
|
ISP_NVRAM_REQ_ACK_ACTIVE_NEGATION(nvram_data);
|
|
|
|
|
|
|
|
sdp->isp_data_line_active_neg =
|
|
|
|
ISP_NVRAM_DATA_LINE_ACTIVE_NEGATION(nvram_data);
|
|
|
|
|
|
|
|
sdp->isp_data_dma_burst_enabl =
|
|
|
|
ISP_NVRAM_DATA_DMA_BURST_ENABLE(nvram_data);
|
|
|
|
|
|
|
|
sdp->isp_cmd_dma_burst_enable =
|
|
|
|
ISP_NVRAM_CMD_DMA_BURST_ENABLE(nvram_data);
|
|
|
|
|
|
|
|
sdp->isp_tag_aging =
|
|
|
|
ISP_NVRAM_TAG_AGE_LIMIT(nvram_data);
|
|
|
|
|
|
|
|
sdp->isp_selection_timeout =
|
|
|
|
ISP_NVRAM_SELECTION_TIMEOUT(nvram_data);
|
|
|
|
|
|
|
|
sdp->isp_max_queue_depth =
|
|
|
|
ISP_NVRAM_MAX_QUEUE_DEPTH(nvram_data);
|
|
|
|
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_fast_mttr = ISP_NVRAM_FAST_MTTR_ENABLE(nvram_data);
|
1999-02-09 01:07:06 +00:00
|
|
|
if (isp->isp_dblev > 2) {
|
|
|
|
PRINTF("%s: NVRAM values:\n", isp->isp_name);
|
|
|
|
PRINTF(" Fifo Threshold = 0x%x\n",
|
|
|
|
sdp->isp_fifo_threshold);
|
|
|
|
PRINTF(" Bus Reset Delay = %d\n",
|
|
|
|
sdp->isp_bus_reset_delay);
|
|
|
|
PRINTF(" Retry Count = %d\n",
|
|
|
|
sdp->isp_retry_count);
|
|
|
|
PRINTF(" Retry Delay = %d\n",
|
|
|
|
sdp->isp_retry_delay);
|
|
|
|
PRINTF(" Tag Age Limit = %d\n",
|
|
|
|
sdp->isp_tag_aging);
|
|
|
|
PRINTF(" Selection Timeout = %d\n",
|
|
|
|
sdp->isp_selection_timeout);
|
|
|
|
PRINTF(" Max Queue Depth = %d\n",
|
|
|
|
sdp->isp_max_queue_depth);
|
|
|
|
PRINTF(" Async Data Setup = 0x%x\n",
|
|
|
|
sdp->isp_async_data_setup);
|
|
|
|
PRINTF(" REQ/ACK Active Negation = %s\n",
|
1999-05-11 05:06:55 +00:00
|
|
|
sdp->isp_req_ack_active_neg? tru : not);
|
1999-02-09 01:07:06 +00:00
|
|
|
PRINTF(" Data Line Active Negation = %s\n",
|
1999-05-11 05:06:55 +00:00
|
|
|
sdp->isp_data_line_active_neg? tru : not);
|
1999-02-09 01:07:06 +00:00
|
|
|
PRINTF(" Data DMA Burst Enable = %s\n",
|
1999-05-11 05:06:55 +00:00
|
|
|
sdp->isp_data_dma_burst_enabl? tru : not);
|
1999-02-09 01:07:06 +00:00
|
|
|
PRINTF(" Cmd DMA Burst Enable = %s\n",
|
1999-05-11 05:06:55 +00:00
|
|
|
sdp->isp_cmd_dma_burst_enable? tru : not);
|
1999-02-09 01:07:06 +00:00
|
|
|
PRINTF(" Fast MTTR = %s\n",
|
1999-05-11 05:06:55 +00:00
|
|
|
isp->isp_fast_mttr? tru : not);
|
1999-02-09 01:07:06 +00:00
|
|
|
}
|
|
|
|
for (i = 0; i < MAX_TARGETS; i++) {
|
1998-09-15 08:42:56 +00:00
|
|
|
sdp->isp_devparam[i].dev_enable =
|
|
|
|
ISP_NVRAM_TGT_DEVICE_ENABLE(nvram_data, i);
|
|
|
|
sdp->isp_devparam[i].exc_throttle =
|
|
|
|
ISP_NVRAM_TGT_EXEC_THROTTLE(nvram_data, i);
|
|
|
|
sdp->isp_devparam[i].sync_offset =
|
|
|
|
ISP_NVRAM_TGT_SYNC_OFFSET(nvram_data, i);
|
|
|
|
sdp->isp_devparam[i].sync_period =
|
|
|
|
ISP_NVRAM_TGT_SYNC_PERIOD(nvram_data, i);
|
|
|
|
|
|
|
|
if (isp->isp_type < ISP_HA_SCSI_1040) {
|
|
|
|
/*
|
|
|
|
* If we're not ultra, we can't possibly
|
|
|
|
* be a shorter period than this.
|
|
|
|
*/
|
|
|
|
if (sdp->isp_devparam[i].sync_period < 0x19) {
|
|
|
|
sdp->isp_devparam[i].sync_period =
|
|
|
|
0x19;
|
|
|
|
}
|
|
|
|
if (sdp->isp_devparam[i].sync_offset > 0xc) {
|
|
|
|
sdp->isp_devparam[i].sync_offset =
|
|
|
|
0x0c;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (sdp->isp_devparam[i].sync_offset > 0x8) {
|
|
|
|
sdp->isp_devparam[i].sync_offset = 0x8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sdp->isp_devparam[i].dev_flags = 0;
|
|
|
|
if (ISP_NVRAM_TGT_RENEG(nvram_data, i))
|
|
|
|
sdp->isp_devparam[i].dev_flags |= DPARM_RENEG;
|
|
|
|
if (ISP_NVRAM_TGT_QFRZ(nvram_data, i)) {
|
|
|
|
PRINTF("%s: not supporting QFRZ option for "
|
|
|
|
"target %d\n", isp->isp_name, i);
|
|
|
|
}
|
|
|
|
sdp->isp_devparam[i].dev_flags |= DPARM_ARQ;
|
|
|
|
if (ISP_NVRAM_TGT_ARQ(nvram_data, i) == 0) {
|
|
|
|
PRINTF("%s: not disabling ARQ option for "
|
|
|
|
"target %d\n", isp->isp_name, i);
|
|
|
|
}
|
|
|
|
if (ISP_NVRAM_TGT_TQING(nvram_data, i))
|
|
|
|
sdp->isp_devparam[i].dev_flags |= DPARM_TQING;
|
|
|
|
if (ISP_NVRAM_TGT_SYNC(nvram_data, i))
|
|
|
|
sdp->isp_devparam[i].dev_flags |= DPARM_SYNC;
|
|
|
|
if (ISP_NVRAM_TGT_WIDE(nvram_data, i))
|
|
|
|
sdp->isp_devparam[i].dev_flags |= DPARM_WIDE;
|
|
|
|
if (ISP_NVRAM_TGT_PARITY(nvram_data, i))
|
|
|
|
sdp->isp_devparam[i].dev_flags |= DPARM_PARITY;
|
|
|
|
if (ISP_NVRAM_TGT_DISC(nvram_data, i))
|
|
|
|
sdp->isp_devparam[i].dev_flags |= DPARM_DISC;
|
1999-03-25 22:52:45 +00:00
|
|
|
sdp->isp_devparam[i].cur_dflags = 0; /* we don't know */
|
1999-02-09 01:07:06 +00:00
|
|
|
if (isp->isp_dblev > 2) {
|
|
|
|
PRINTF(" Target %d: Enabled %d Throttle %d "
|
|
|
|
"Offset %d Period %d Flags 0x%x\n", i,
|
|
|
|
sdp->isp_devparam[i].dev_enable,
|
|
|
|
sdp->isp_devparam[i].exc_throttle,
|
|
|
|
sdp->isp_devparam[i].sync_offset,
|
|
|
|
sdp->isp_devparam[i].sync_period,
|
|
|
|
sdp->isp_devparam[i].dev_flags);
|
|
|
|
}
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
fcparam *fcp = (fcparam *) isp->isp_param;
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
|
|
|
u_int32_t hi32;
|
|
|
|
u_int32_t lo32;
|
|
|
|
#else
|
|
|
|
u_int32_t lo32;
|
|
|
|
u_int32_t hi32;
|
|
|
|
#endif
|
1999-08-16 19:59:55 +00:00
|
|
|
} wd;
|
1998-09-15 08:42:56 +00:00
|
|
|
u_int64_t full64;
|
|
|
|
} wwnstore;
|
|
|
|
|
|
|
|
wwnstore.full64 = ISP2100_NVRAM_NODE_NAME(nvram_data);
|
1999-08-16 19:59:55 +00:00
|
|
|
/*
|
|
|
|
* Broken PTI cards with nothing in the top nibble. Pah.
|
|
|
|
*/
|
|
|
|
if ((wwnstore.wd.hi32 >> 28) == 0) {
|
|
|
|
wwnstore.wd.hi32 |= (2 << 28);
|
1999-10-17 18:58:22 +00:00
|
|
|
CFGPRINTF("%s: (corrected) Adapter WWN 0x%08x%08x\n",
|
1999-08-16 19:59:55 +00:00
|
|
|
isp->isp_name, wwnstore.wd.hi32, wwnstore.wd.lo32);
|
|
|
|
} else {
|
1999-10-17 18:58:22 +00:00
|
|
|
CFGPRINTF("%s: Adapter WWN 0x%08x%08x\n", isp->isp_name,
|
1999-08-16 19:59:55 +00:00
|
|
|
wwnstore.wd.hi32, wwnstore.wd.lo32);
|
|
|
|
}
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
fcp->isp_nodewwn = wwnstore.full64;
|
1999-08-16 19:59:55 +00:00
|
|
|
|
Roll revision levels. Add support for the Qlogic 2200 (warn about
not having SCSI_ISP_SCCLUN config defined if we don't have f/w for
the 2200- it's resident firmware uses SCCLUN (65535 luns)). Change
the way the default LoopID is gathered (it's now a platform specific
define so that some attempt at a synthetic WWN can be made in case
NVRAM isn't readable).
Change initialization of options a bit- don't use ADISC. Set
FullDuplex mode if config options tells us to do so. Do not use
FULL_LOGIN after LIP- it's the right thing to do but it causes too
much loop disruption (Loop Resets). Sanity check some default
values. Redo construction of port and node WWNs based upon what we
have- if we have 2 in the top nibble, we can have distinct port
and node WWNs. Clean up some SCCLUN related code that we obviously
had never compiled (:-(). Audit commands coming int ispscsicmd and
don't throw commands at Fibre devices that do not have Class 3
service parameters TARGET ROLE defined.
Clean up f/w initialization a bit. Add Fabric support (or at least
the first blush of it). Whew - way too much to describe here.
Basically, after a LIP, hang out until we see a Loop Up or a Port
DataBase Change async event, then see if we're on a Fabric
(GET_PORT_NAME of FL_PORT_ID). If we are, try and scan the fabric
controller for fabric devices using the GetAllNext SNS subcommand.
As we find devices, announce them to the outer layer. Try and do
some guard code for broken (Brocade) SNS servers (that get stuck
in loops- gotta maybe do this a different way using the GP_ID3 cmd
instead). Then do a scan of the lower (local loop) ids using a
GET_PORT_NAME to see if the f/w has logged into anything at that
loop id. If so, then do a GET_PORT_DATABASE command. Do this scan
into a local database. At this point we can say the loop is 'Ready'.
After this, we merge our local loop port database with our stored
port database- in a as yet to be really fully exercised fashion we
try and follow the logic of something having moved around. The
first time we see something at a Loop ID, we fix it, for the purpose
of this system instance, at that Loop ID. If things shift around
so it ends up somewhere else, we still keep it at this Loop ID (our
'Target') but use the new (moved) Loop ID when we actually throw
commands at it. Check for insane cases of different Loop IDs both
claiming to have the same WWN- if that happens, invalidate both.
Notify the outer layer of devices that have arrived and devices
that have gone away. *Finally*, when this is done, search the
softc's database of Fabric devices and perform logout/login actions.
The Qlogic f/w maintains logout/login for all local loop devices.
We have to maintain logout/login for fabric devices- total PITA.
Expect to see this area undergo more change over time.
1999-07-02 23:06:38 +00:00
|
|
|
/*
|
|
|
|
* If the Node WWN has 2 in the top nibble, we can
|
|
|
|
* authoritatively construct a Port WWN by adding
|
|
|
|
* our unit number (plus one to make it nonzero) and
|
|
|
|
* putting it into bits 59..56. If the top nibble isn't
|
|
|
|
* 2, then we just set them identically.
|
|
|
|
*/
|
|
|
|
if ((fcp->isp_nodewwn >> 60) == 2) {
|
|
|
|
fcp->isp_portwwn = fcp->isp_nodewwn |
|
|
|
|
(((u_int64_t)(isp->isp_unit+1)) << 56);
|
|
|
|
} else {
|
|
|
|
fcp->isp_portwwn = fcp->isp_nodewwn;
|
|
|
|
}
|
1998-09-15 08:42:56 +00:00
|
|
|
wwnstore.full64 = ISP2100_NVRAM_BOOT_NODE_NAME(nvram_data);
|
|
|
|
if (wwnstore.full64 != 0) {
|
1998-12-05 01:33:57 +00:00
|
|
|
PRINTF("%s: BOOT DEVICE WWN 0x%08x%08x\n",
|
1999-08-16 19:59:55 +00:00
|
|
|
isp->isp_name, wwnstore.wd.hi32, wwnstore.wd.lo32);
|
1998-09-15 08:42:56 +00:00
|
|
|
}
|
|
|
|
fcp->isp_maxalloc =
|
|
|
|
ISP2100_NVRAM_MAXIOCBALLOCATION(nvram_data);
|
|
|
|
fcp->isp_maxfrmlen =
|
|
|
|
ISP2100_NVRAM_MAXFRAMELENGTH(nvram_data);
|
|
|
|
fcp->isp_retry_delay =
|
|
|
|
ISP2100_NVRAM_RETRY_DELAY(nvram_data);
|
|
|
|
fcp->isp_retry_count =
|
|
|
|
ISP2100_NVRAM_RETRY_COUNT(nvram_data);
|
|
|
|
fcp->isp_loopid =
|
|
|
|
ISP2100_NVRAM_HARDLOOPID(nvram_data);
|
|
|
|
fcp->isp_execthrottle =
|
|
|
|
ISP2100_NVRAM_EXECUTION_THROTTLE(nvram_data);
|
1999-02-09 01:07:06 +00:00
|
|
|
fcp->isp_fwoptions = ISP2100_NVRAM_OPTIONS(nvram_data);
|
|
|
|
if (isp->isp_dblev > 2) {
|
|
|
|
PRINTF("%s: NVRAM values:\n", isp->isp_name);
|
|
|
|
PRINTF(" Max IOCB Allocation = %d\n",
|
|
|
|
fcp->isp_maxalloc);
|
|
|
|
PRINTF(" Max Frame Length = %d\n",
|
|
|
|
fcp->isp_maxfrmlen);
|
|
|
|
PRINTF(" Execution Throttle = %d\n",
|
|
|
|
fcp->isp_execthrottle);
|
|
|
|
PRINTF(" Retry Count = %d\n",
|
|
|
|
fcp->isp_retry_count);
|
|
|
|
PRINTF(" Retry Delay = %d\n",
|
|
|
|
fcp->isp_retry_delay);
|
|
|
|
PRINTF(" Hard Loop ID = %d\n",
|
|
|
|
fcp->isp_loopid);
|
|
|
|
PRINTF(" Options = 0x%x\n",
|
|
|
|
fcp->isp_fwoptions);
|
|
|
|
PRINTF(" HBA Options = 0x%x\n",
|
|
|
|
ISP2100_NVRAM_HBA_OPTIONS(nvram_data));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
IDPRINTF(3, ("%s: NVRAM is valid\n", isp->isp_name));
|
1998-09-15 08:42:56 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
isp_rdnvram_word(isp, wo, rp)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
int wo;
|
|
|
|
u_int16_t *rp;
|
|
|
|
{
|
|
|
|
int i, cbits;
|
|
|
|
u_int16_t bit, rqst;
|
|
|
|
|
|
|
|
ISP_WRITE(isp, BIU_NVRAM, BIU_NVRAM_SELECT);
|
|
|
|
SYS_DELAY(2);
|
|
|
|
ISP_WRITE(isp, BIU_NVRAM, BIU_NVRAM_SELECT|BIU_NVRAM_CLOCK);
|
|
|
|
SYS_DELAY(2);
|
|
|
|
|
1999-05-11 05:06:55 +00:00
|
|
|
if (IS_FC(isp)) {
|
1998-09-15 08:42:56 +00:00
|
|
|
wo &= ((ISP2100_NVRAM_SIZE >> 1) - 1);
|
|
|
|
rqst = (ISP_NVRAM_READ << 8) | wo;
|
1999-05-11 05:06:55 +00:00
|
|
|
cbits = 10;
|
1999-12-16 05:42:02 +00:00
|
|
|
} else if (IS_ULTRA2(isp)) {
|
1999-05-11 05:06:55 +00:00
|
|
|
wo &= ((ISP1080_NVRAM_SIZE >> 1) - 1);
|
|
|
|
rqst = (ISP_NVRAM_READ << 8) | wo;
|
1998-09-15 08:42:56 +00:00
|
|
|
cbits = 10;
|
|
|
|
} else {
|
|
|
|
wo &= ((ISP_NVRAM_SIZE >> 1) - 1);
|
|
|
|
rqst = (ISP_NVRAM_READ << 6) | wo;
|
|
|
|
cbits = 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Clock the word select request out...
|
|
|
|
*/
|
|
|
|
for (i = cbits; i >= 0; i--) {
|
|
|
|
if ((rqst >> i) & 1) {
|
|
|
|
bit = BIU_NVRAM_SELECT | BIU_NVRAM_DATAOUT;
|
|
|
|
} else {
|
|
|
|
bit = BIU_NVRAM_SELECT;
|
|
|
|
}
|
|
|
|
ISP_WRITE(isp, BIU_NVRAM, bit);
|
|
|
|
SYS_DELAY(2);
|
|
|
|
ISP_WRITE(isp, BIU_NVRAM, bit | BIU_NVRAM_CLOCK);
|
|
|
|
SYS_DELAY(2);
|
|
|
|
ISP_WRITE(isp, BIU_NVRAM, bit);
|
|
|
|
SYS_DELAY(2);
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Now read the result back in (bits come back in MSB format).
|
|
|
|
*/
|
|
|
|
*rp = 0;
|
|
|
|
for (i = 0; i < 16; i++) {
|
|
|
|
u_int16_t rv;
|
|
|
|
*rp <<= 1;
|
|
|
|
ISP_WRITE(isp, BIU_NVRAM, BIU_NVRAM_SELECT|BIU_NVRAM_CLOCK);
|
|
|
|
SYS_DELAY(2);
|
|
|
|
rv = ISP_READ(isp, BIU_NVRAM);
|
|
|
|
if (rv & BIU_NVRAM_DATAIN) {
|
|
|
|
*rp |= 1;
|
|
|
|
}
|
|
|
|
SYS_DELAY(2);
|
|
|
|
ISP_WRITE(isp, BIU_NVRAM, BIU_NVRAM_SELECT);
|
|
|
|
SYS_DELAY(2);
|
|
|
|
}
|
|
|
|
ISP_WRITE(isp, BIU_NVRAM, 0);
|
|
|
|
SYS_DELAY(2);
|
|
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
|
|
|
*rp = ((*rp >> 8) | ((*rp & 0xff) << 8));
|
|
|
|
#endif
|
|
|
|
}
|