Don't attempt to load illegal hard loop addresses into

an ICB. This shows up on card restarts, and usually for
2200-2300 cards. What happens is that we start up,
attempting to acquire a hard address. We end up instead
being an F-port topology, which reports out a loop id
of 0xff (or 0xffff for 2K Login f/w). Then, if we restart,
we end up telling the card to go off an acquire this loop
address, which the card then rejects. Bah.

Compilation fixes from Solaris port.
This commit is contained in:
Matt Jacob 2007-02-23 21:59:21 +00:00
parent 217d9e4862
commit af4394d40a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=166929
3 changed files with 31 additions and 49 deletions

View File

@ -1555,6 +1555,7 @@ isp_fibre_init(ispsoftc_t *isp)
fcparam *fcp; fcparam *fcp;
isp_icb_t local, *icbp = &local; isp_icb_t local, *icbp = &local;
mbreg_t mbs; mbreg_t mbs;
int ownloopid;
uint64_t nwwn, pwwn; uint64_t nwwn, pwwn;
fcp = isp->isp_param; fcp = isp->isp_param;
@ -1630,25 +1631,17 @@ isp_fibre_init(ispsoftc_t *isp)
icbp->icb_retry_delay = fcp->isp_retry_delay; icbp->icb_retry_delay = fcp->isp_retry_delay;
icbp->icb_retry_count = fcp->isp_retry_count; icbp->icb_retry_count = fcp->isp_retry_count;
icbp->icb_hardaddr = fcp->isp_loopid; icbp->icb_hardaddr = fcp->isp_loopid;
ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0;
if (icbp->icb_hardaddr > 125) { if (icbp->icb_hardaddr > 125) {
/* icbp->icb_hardaddr = 0;
* We end up with these Loop IDs for F-Port topologies ownloopid = 0;
*/
if (icbp->icb_hardaddr != 0xff &&
icbp->icb_hardaddr != 0x800 &&
icbp->icb_hardaddr != 0xffff) {
isp_prt(isp, ISP_LOGERR,
"bad hard address %u- resetting to zero",
icbp->icb_hardaddr);
icbp->icb_hardaddr = 0;
}
} }
/* /*
* Our life seems so much better with 2200s and later with * Our life seems so much better with 2200s and later with
* the latest f/w if we set Hard Address. * the latest f/w if we set Hard Address.
*/ */
if (ISP_FW_NEWER_THAN(isp, 2, 2, 5)) { if (ownloopid || ISP_FW_NEWER_THAN(isp, 2, 2, 5)) {
icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS; icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS;
} }
@ -1800,6 +1793,7 @@ isp_fibre_init(ispsoftc_t *isp)
isp_mboxcmd(isp, &mbs); isp_mboxcmd(isp, &mbs);
FC_SCRATCH_RELEASE(isp); FC_SCRATCH_RELEASE(isp);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
isp_print_bytes(isp, "isp_fibre_init", sizeof (*icbp), icbp);
return; return;
} }
isp->isp_reqidx = 0; isp->isp_reqidx = 0;
@ -1818,6 +1812,7 @@ isp_fibre_init_2400(ispsoftc_t *isp)
fcparam *fcp; fcparam *fcp;
isp_icb_2400_t local, *icbp = &local; isp_icb_2400_t local, *icbp = &local;
mbreg_t mbs; mbreg_t mbs;
int ownloopid;
uint64_t nwwn, pwwn; uint64_t nwwn, pwwn;
fcp = isp->isp_param; fcp = isp->isp_param;
@ -1886,21 +1881,12 @@ isp_fibre_init_2400(ispsoftc_t *isp)
icbp->icb_fwoptions1 = fcp->isp_fwoptions; icbp->icb_fwoptions1 = fcp->isp_fwoptions;
icbp->icb_hardaddr = fcp->isp_loopid; icbp->icb_hardaddr = fcp->isp_loopid;
ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0;
if (icbp->icb_hardaddr > 125) { if (icbp->icb_hardaddr > 125) {
/* icbp->icb_hardaddr = 0;
* We end up with these Loop IDs for F-Port topologies ownloopid = 0;
*/
if (icbp->icb_hardaddr != 0xff &&
icbp->icb_hardaddr != 0x800 &&
icbp->icb_hardaddr != 0xffff) {
isp_prt(isp, ISP_LOGERR,
"bad hard address %u- resetting to zero",
icbp->icb_hardaddr);
icbp->icb_hardaddr = 0;
}
} }
if (ownloopid) {
if (isp->isp_confopts & ISP_CFG_OWNLOOPID) {
icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS; icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS;
} }
@ -2280,7 +2266,6 @@ isp_port_login(ispsoftc_t *isp, uint16_t handle, uint32_t portid)
"isp_plogi_old: portid 0x%06x already logged in as %u", "isp_plogi_old: portid 0x%06x already logged in as %u",
portid, mbs.param[1]); portid, mbs.param[1]);
return (MBOX_PORT_ID_USED | (mbs.param[1] << 16)); return (MBOX_PORT_ID_USED | (mbs.param[1] << 16));
break;
case MBOX_LOOP_ID_USED: case MBOX_LOOP_ID_USED:
isp_prt(isp, ISP_LOGDEBUG0, isp_prt(isp, ISP_LOGDEBUG0,
@ -2963,19 +2948,17 @@ isp_scan_loop(ispsoftc_t *isp)
/* /*
* Check to make sure it's still a valid entry. The 24XX seems * Check to make sure it's still a valid entry. The 24XX seems
* to return a portid but not a WWPN/WWNN or role for devices * to return a portid but not a WWPN/WWNN or role for devices
* which shift on a loop, or have a WWPN/WWNN but no portid. * which shift on a loop.
*/ */
if (tmp.node_wwn == 0 || tmp.port_wwn == 0 || tmp.portid == 0) { if (tmp.node_wwn == 0 || tmp.port_wwn == 0 || tmp.portid == 0) {
if (isp->isp_dblev & ISP_LOGSANCFG) { int a, b, c;
int a, b, c; a = (tmp.node_wwn == 0);
a = !(tmp.node_wwn == 0); b = (tmp.port_wwn == 0);
b = !(tmp.port_wwn == 0); c = (tmp.portid == 0);
c = !(tmp.portid == 0); isp_prt(isp, ISP_LOGWARN,
isp_prt(isp, ISP_LOGALL, "bad pdb (%1d%1d%1d) @ handle 0x%x", a, b, c,
"bad pdb (%1d%1d%1d) @ handle 0x%x", handle);
a, b, c, handle); isp_dump_portdb(isp);
isp_dump_portdb(isp);
}
continue; continue;
} }
@ -4576,7 +4559,6 @@ isp_intr(ispsoftc_t *isp, uint32_t isr, uint16_t sema, uint16_t mbox)
if ((IS_FC(isp) && mbox != ASYNC_RIO_RESP) || if ((IS_FC(isp) && mbox != ASYNC_RIO_RESP) ||
isp->isp_state != ISP_RUNSTATE) { isp->isp_state != ISP_RUNSTATE) {
goto out; goto out;
return;
} }
} }
@ -7523,11 +7505,11 @@ isp_rd_2400_nvram(ispsoftc_t *isp, uint32_t addr, uint32_t *rp)
for (loops = 0; loops < 5000; loops++) { for (loops = 0; loops < 5000; loops++) {
USEC_DELAY(10); USEC_DELAY(10);
tmp = ISP_READ(isp, BIU2400_FLASH_ADDR); tmp = ISP_READ(isp, BIU2400_FLASH_ADDR);
if ((tmp & (1 << 31)) != 0) { if ((tmp & (1U << 31)) != 0) {
break; break;
} }
} }
if (tmp & (1 << 31)) { if (tmp & (1U << 31)) {
tmp = ISP_READ(isp, BIU2400_FLASH_DATA); tmp = ISP_READ(isp, BIU2400_FLASH_DATA);
*rp = tmp; *rp = tmp;
} else { } else {

View File

@ -643,7 +643,7 @@ typedef struct {
uint16_t ms_flags; uint16_t ms_flags;
uint16_t ms_reserved1; /* low 8 bits */ uint16_t ms_reserved1; /* low 8 bits */
uint16_t ms_time; uint16_t ms_time;
uint16_t ms_cmd_cnt; /* Command DSD count */; uint16_t ms_cmd_cnt; /* Command DSD count */
uint16_t ms_tot_cnt; /* Total DSD Count */ uint16_t ms_tot_cnt; /* Total DSD Count */
uint8_t ms_type; /* MS type */ uint8_t ms_type; /* MS type */
uint8_t ms_r_ctl; /* R_CTL */ uint8_t ms_r_ctl; /* R_CTL */

View File

@ -409,14 +409,14 @@
/* BIU2400_HCCR definitions */ /* BIU2400_HCCR definitions */
#define HCCR_2400_CMD_NOP (0x0 << 28) #define HCCR_2400_CMD_NOP 0x00000000
#define HCCR_2400_CMD_RESET (0x1 << 28) #define HCCR_2400_CMD_RESET 0x10000000
#define HCCR_2400_CMD_CLEAR_RESET (0x2 << 28) #define HCCR_2400_CMD_CLEAR_RESET 0x20000000
#define HCCR_2400_CMD_PAUSE (0x3 << 28) #define HCCR_2400_CMD_PAUSE 0x30000000
#define HCCR_2400_CMD_RELEASE (0x4 << 28) #define HCCR_2400_CMD_RELEASE 0x40000000
#define HCCR_2400_CMD_SET_HOST_INT (0x5 << 28) #define HCCR_2400_CMD_SET_HOST_INT 0x50000000
#define HCCR_2400_CMD_CLEAR_HOST_INT (0x6 << 28) #define HCCR_2400_CMD_CLEAR_HOST_INT 0x60000000
#define HCCR_2400_CMD_CLEAR_RISC_INT (0xA << 28) #define HCCR_2400_CMD_CLEAR_RISC_INT 0xA0000000
#define HCCR_2400_RISC_ERR(x) (((x) >> 12) & 0x7) /* RO */ #define HCCR_2400_RISC_ERR(x) (((x) >> 12) & 0x7) /* RO */
#define HCCR_2400_RISC2HOST_INT (1 << 6) /* RO */ #define HCCR_2400_RISC2HOST_INT (1 << 6) /* RO */