Deleted Added
full compact
isp.c (151834) isp.c (154704)
1/* $FreeBSD: head/sys/dev/isp/isp.c 151834 2005-10-29 02:46:59Z mjacob $ */
2/*-
3 * Machine and OS Independent (well, as best as possible)
4 * code for the Qlogic ISP SCSI adapters.
5 *
1/*-
2 * Machine and OS Independent (well, as best as possible)
3 * code for the Qlogic ISP SCSI adapters.
4 *
6 * Copyright (c) 1997, 1998, 1999, 2000, 2001 by Matthew Jacob
7 * Feral Software
5 * Copyright (c) 1997-2006 by Matthew Jacob
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice immediately at the beginning of the file, without modification,
15 * this list of conditions, and the following disclaimer.

--- 22 unchanged lines hidden (view full) ---

38/*
39 * Include header file appropriate for platform we're building on.
40 */
41
42#ifdef __NetBSD__
43#include <dev/ic/isp_netbsd.h>
44#endif
45#ifdef __FreeBSD__
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice immediately at the beginning of the file, without modification,
13 * this list of conditions, and the following disclaimer.

--- 22 unchanged lines hidden (view full) ---

36/*
37 * Include header file appropriate for platform we're building on.
38 */
39
40#ifdef __NetBSD__
41#include <dev/ic/isp_netbsd.h>
42#endif
43#ifdef __FreeBSD__
44#include <sys/cdefs.h>
45__FBSDID("$FreeBSD: head/sys/dev/isp/isp.c 154704 2006-01-23 06:23:37Z mjacob $");
46#include <dev/isp/isp_freebsd.h>
47#endif
48#ifdef __OpenBSD__
49#include <dev/ic/isp_openbsd.h>
50#endif
51#ifdef __linux__
52#include "isp_linux.h"
53#endif

--- 36 unchanged lines hidden (view full) ---

90 "HBA attempted queued transaction with disconnect not set for %d.%d.%d";
91static const char xact2[] =
92 "HBA attempted queued transaction to target routine %d on target %d bus %d";
93static const char xact3[] =
94 "HBA attempted queued cmd for %d.%d.%d when queueing disabled";
95static const char pskip[] =
96 "SCSI phase skipped for target %d.%d.%d";
97static const char topology[] =
46#include <dev/isp/isp_freebsd.h>
47#endif
48#ifdef __OpenBSD__
49#include <dev/ic/isp_openbsd.h>
50#endif
51#ifdef __linux__
52#include "isp_linux.h"
53#endif

--- 36 unchanged lines hidden (view full) ---

90 "HBA attempted queued transaction with disconnect not set for %d.%d.%d";
91static const char xact2[] =
92 "HBA attempted queued transaction to target routine %d on target %d bus %d";
93static const char xact3[] =
94 "HBA attempted queued cmd for %d.%d.%d when queueing disabled";
95static const char pskip[] =
96 "SCSI phase skipped for target %d.%d.%d";
97static const char topology[] =
98 "Loop ID %d, AL_PA 0x%x, Port ID 0x%x, Loop State 0x%x, Topology '%s'";
98 "Loop ID %d, Port ID 0x%x, Loop State 0x%x, Topology '%s'";
99static const char swrej[] =
100 "Fabric Nameserver rejected %s (Reason=0x%x Expl=0x%x) for Port ID 0x%x";
101static const char finmsg[] =
102 "(%d.%d.%d): FIN dl%d resid %d STS 0x%x SKEY %c XS_ERR=0x%x";
103static const char sc0[] =
104 "%s CHAN %d FTHRSH %d IID %d RESETD %d RETRYC %d RETRYD %d ASD 0x%x";
105static const char sc1[] =
106 "%s RAAN 0x%x DLAN 0x%x DDMAB 0x%x CDMAB 0x%x SELTIME %d MQD %d";

--- 53 unchanged lines hidden (view full) ---

160isp_reset(struct ispsoftc *isp)
161{
162 mbreg_t mbs;
163 u_int16_t code_org;
164 int loops, i, dodnld = 1;
165 char *btype = "????";
166
167 isp->isp_state = ISP_NILSTATE;
99static const char swrej[] =
100 "Fabric Nameserver rejected %s (Reason=0x%x Expl=0x%x) for Port ID 0x%x";
101static const char finmsg[] =
102 "(%d.%d.%d): FIN dl%d resid %d STS 0x%x SKEY %c XS_ERR=0x%x";
103static const char sc0[] =
104 "%s CHAN %d FTHRSH %d IID %d RESETD %d RETRYC %d RETRYD %d ASD 0x%x";
105static const char sc1[] =
106 "%s RAAN 0x%x DLAN 0x%x DDMAB 0x%x CDMAB 0x%x SELTIME %d MQD %d";

--- 53 unchanged lines hidden (view full) ---

160isp_reset(struct ispsoftc *isp)
161{
162 mbreg_t mbs;
163 u_int16_t code_org;
164 int loops, i, dodnld = 1;
165 char *btype = "????";
166
167 isp->isp_state = ISP_NILSTATE;
168 MEMZERO(&mbs, sizeof (mbs));
168
169 /*
170 * Basic types (SCSI, FibreChannel and PCI or SBus)
171 * have been set in the MD code. We figure out more
172 * here. Possibly more refined types based upon PCI
173 * identification. Chip revision has been gathered.
174 *
175 * After we've fired this chip up, zero out the conf1 register

--- 71 unchanged lines hidden (view full) ---

247 btype = "2200";
248 break;
249 case ISP_HA_FC_2300:
250 btype = "2300";
251 break;
252 case ISP_HA_FC_2312:
253 btype = "2312";
254 break;
169
170 /*
171 * Basic types (SCSI, FibreChannel and PCI or SBus)
172 * have been set in the MD code. We figure out more
173 * here. Possibly more refined types based upon PCI
174 * identification. Chip revision has been gathered.
175 *
176 * After we've fired this chip up, zero out the conf1 register

--- 71 unchanged lines hidden (view full) ---

248 btype = "2200";
249 break;
250 case ISP_HA_FC_2300:
251 btype = "2300";
252 break;
253 case ISP_HA_FC_2312:
254 btype = "2312";
255 break;
256 case ISP_HA_FC_2322:
257 btype = "2322";
258 break;
259 case ISP_HA_FC_2422:
260 btype = "2422";
261 break;
255 default:
256 break;
257 }
258 /*
259 * While we're paused, reset the FPM module and FBM fifos.
260 */
261 ISP_WRITE(isp, BIU2100_CSR, BIU2100_FPM0_REGS);
262 ISP_WRITE(isp, FPM_DIAG_CONFIG, FPM_SOFT_RESET);

--- 409 unchanged lines hidden (view full) ---

672 *
673 * If we didn't actually download f/w,
674 * we still need to (re)start it.
675 */
676
677
678 mbs.param[0] = MBOX_EXEC_FIRMWARE;
679 mbs.param[1] = code_org;
262 default:
263 break;
264 }
265 /*
266 * While we're paused, reset the FPM module and FBM fifos.
267 */
268 ISP_WRITE(isp, BIU2100_CSR, BIU2100_FPM0_REGS);
269 ISP_WRITE(isp, FPM_DIAG_CONFIG, FPM_SOFT_RESET);

--- 409 unchanged lines hidden (view full) ---

679 *
680 * If we didn't actually download f/w,
681 * we still need to (re)start it.
682 */
683
684
685 mbs.param[0] = MBOX_EXEC_FIRMWARE;
686 mbs.param[1] = code_org;
687 if (IS_2322(isp) || IS_24XX(isp)) {
688 if (isp->isp_loaded_fw) {
689 mbs.param[2] = 1;
690 } else {
691 mbs.param[2] = 0;
692 }
693 mbs.obits |= 2;
694 }
695
680 isp_mboxcmd(isp, &mbs, MBLOGNONE);
681 /*
682 * Give it a chance to start.
683 */
684 USEC_DELAY(500);
685
686 if (IS_SCSI(isp)) {
687 /*

--- 53 unchanged lines hidden (view full) ---

741#else
742 FCPARAM(isp)->isp_fwattr = 0;
743#endif
744 } else {
745 FCPARAM(isp)->isp_fwattr = mbs.param[6];
746 isp_prt(isp, ISP_LOGDEBUG0,
747 "Firmware Attributes = 0x%x", mbs.param[6]);
748 }
696 isp_mboxcmd(isp, &mbs, MBLOGNONE);
697 /*
698 * Give it a chance to start.
699 */
700 USEC_DELAY(500);
701
702 if (IS_SCSI(isp)) {
703 /*

--- 53 unchanged lines hidden (view full) ---

757#else
758 FCPARAM(isp)->isp_fwattr = 0;
759#endif
760 } else {
761 FCPARAM(isp)->isp_fwattr = mbs.param[6];
762 isp_prt(isp, ISP_LOGDEBUG0,
763 "Firmware Attributes = 0x%x", mbs.param[6]);
764 }
749 if (ISP_READ(isp, BIU2100_CSR) & BIU2100_PCI64) {
750 isp_prt(isp, ISP_LOGCONFIG,
751 "Installed in 64-Bit PCI slot");
765 if (IS_2KLOGIN(isp)) {
766 isp_prt(isp, ISP_LOGCONFIG, "2K Logins Supported");
752 }
753 }
754
755 if (isp->isp_romfw_rev[0] || isp->isp_romfw_rev[1] ||
756 isp->isp_romfw_rev[2]) {
757 isp_prt(isp, ISP_LOGCONFIG, "Last F/W revision was %d.%d.%d",
758 isp->isp_romfw_rev[0], isp->isp_romfw_rev[1],
759 isp->isp_romfw_rev[2]);

--- 104 unchanged lines hidden (view full) ---

864 if (sdp_chan0->isp_fast_mttr) {
865 ISP_WRITE(isp, RISC_MTR, 0x1313);
866 }
867
868 /*
869 * Set Retry Delay and Count.
870 * You set both channels at the same time.
871 */
767 }
768 }
769
770 if (isp->isp_romfw_rev[0] || isp->isp_romfw_rev[1] ||
771 isp->isp_romfw_rev[2]) {
772 isp_prt(isp, ISP_LOGCONFIG, "Last F/W revision was %d.%d.%d",
773 isp->isp_romfw_rev[0], isp->isp_romfw_rev[1],
774 isp->isp_romfw_rev[2]);

--- 104 unchanged lines hidden (view full) ---

879 if (sdp_chan0->isp_fast_mttr) {
880 ISP_WRITE(isp, RISC_MTR, 0x1313);
881 }
882
883 /*
884 * Set Retry Delay and Count.
885 * You set both channels at the same time.
886 */
887 MEMZERO(&mbs, sizeof (mbs));
872 mbs.param[0] = MBOX_SET_RETRY_COUNT;
873 mbs.param[1] = sdp_chan0->isp_retry_count;
874 mbs.param[2] = sdp_chan0->isp_retry_delay;
875 mbs.param[6] = sdp_chan1->isp_retry_count;
876 mbs.param[7] = sdp_chan1->isp_retry_delay;
877
878 isp_mboxcmd(isp, &mbs, MBLOGALL);
879 if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {

--- 163 unchanged lines hidden (view full) ---

1043 int tgt;
1044
1045 sdp = isp->isp_param;
1046 sdp += channel;
1047
1048 /*
1049 * Set (possibly new) Initiator ID.
1050 */
888 mbs.param[0] = MBOX_SET_RETRY_COUNT;
889 mbs.param[1] = sdp_chan0->isp_retry_count;
890 mbs.param[2] = sdp_chan0->isp_retry_delay;
891 mbs.param[6] = sdp_chan1->isp_retry_count;
892 mbs.param[7] = sdp_chan1->isp_retry_delay;
893
894 isp_mboxcmd(isp, &mbs, MBLOGALL);
895 if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {

--- 163 unchanged lines hidden (view full) ---

1059 int tgt;
1060
1061 sdp = isp->isp_param;
1062 sdp += channel;
1063
1064 /*
1065 * Set (possibly new) Initiator ID.
1066 */
1067 MEMZERO(&mbs, sizeof (mbs));
1051 mbs.param[0] = MBOX_SET_INIT_SCSI_ID;
1052 mbs.param[1] = (channel << 7) | sdp->isp_initiator_id;
1053 isp_mboxcmd(isp, &mbs, MBLOGALL);
1054 if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
1055 return;
1056 }
1057 isp_prt(isp, ISP_LOGINFO, "Initiator ID is %d on Channel %d",
1058 sdp->isp_initiator_id, channel);

--- 193 unchanged lines hidden (view full) ---

1252 fcp->isp_execthrottle);
1253 icbp->icb_execthrottle = ICB_DFLT_THROTTLE;
1254 }
1255 icbp->icb_retry_delay = fcp->isp_retry_delay;
1256 icbp->icb_retry_count = fcp->isp_retry_count;
1257 icbp->icb_hardaddr = loopid;
1258 if (icbp->icb_hardaddr >= 125) {
1259 /*
1068 mbs.param[0] = MBOX_SET_INIT_SCSI_ID;
1069 mbs.param[1] = (channel << 7) | sdp->isp_initiator_id;
1070 isp_mboxcmd(isp, &mbs, MBLOGALL);
1071 if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
1072 return;
1073 }
1074 isp_prt(isp, ISP_LOGINFO, "Initiator ID is %d on Channel %d",
1075 sdp->isp_initiator_id, channel);

--- 193 unchanged lines hidden (view full) ---

1269 fcp->isp_execthrottle);
1270 icbp->icb_execthrottle = ICB_DFLT_THROTTLE;
1271 }
1272 icbp->icb_retry_delay = fcp->isp_retry_delay;
1273 icbp->icb_retry_count = fcp->isp_retry_count;
1274 icbp->icb_hardaddr = loopid;
1275 if (icbp->icb_hardaddr >= 125) {
1276 /*
1260 * We end up with a Loop ID of 255 for F-Port topologies
1277 * We end up with these Loop IDs for F-Port topologies
1261 */
1278 */
1262 if (icbp->icb_hardaddr != 255) {
1279 if (icbp->icb_hardaddr != 0xff || icbp->icb_hardaddr != 0x800) {
1263 isp_prt(isp, ISP_LOGERR,
1264 "bad hard address %u- resetting to zero",
1265 icbp->icb_hardaddr);
1266 }
1267 icbp->icb_hardaddr = 0;
1268 }
1269 /*
1270 * Right now we just set extended options to prefer point-to-point

--- 78 unchanged lines hidden (view full) ---

1349 if (!IS_23XX(isp) && ISP_FW_NEWER_THAN(isp, 1, 17, 0)) {
1350 icbp->icb_xfwoptions |= ICBXOPT_RIO_16BIT;
1351 icbp->icb_racctimer = 4;
1352 icbp->icb_idelaytimer = 8;
1353 }
1354#endif
1355#endif
1356
1280 isp_prt(isp, ISP_LOGERR,
1281 "bad hard address %u- resetting to zero",
1282 icbp->icb_hardaddr);
1283 }
1284 icbp->icb_hardaddr = 0;
1285 }
1286 /*
1287 * Right now we just set extended options to prefer point-to-point

--- 78 unchanged lines hidden (view full) ---

1366 if (!IS_23XX(isp) && ISP_FW_NEWER_THAN(isp, 1, 17, 0)) {
1367 icbp->icb_xfwoptions |= ICBXOPT_RIO_16BIT;
1368 icbp->icb_racctimer = 4;
1369 icbp->icb_idelaytimer = 8;
1370 }
1371#endif
1372#endif
1373
1374 MEMZERO(&mbs, sizeof (mbs));
1375
1357 /*
1376 /*
1358 * For 22XX > 2.1.26 && 23XX, set someoptions.
1377 * For 22XX > 2.1.26 && 23XX, set some options.
1359 * XXX: Probably okay for newer 2100 f/w too.
1360 */
1361 if (ISP_FW_NEWER_THAN(isp, 2, 26, 0)) {
1362 /*
1363 * Turn on LIP F8 async event (1)
1364 * Turn on generate AE 8013 on all LIP Resets (2)
1365 * Disable LIP F7 switching (8)
1366 */

--- 85 unchanged lines hidden (view full) ---

1452 */
1453
1454static int
1455isp_getmap(struct ispsoftc *isp, fcpos_map_t *map)
1456{
1457 fcparam *fcp = (fcparam *) isp->isp_param;
1458 mbreg_t mbs;
1459
1378 * XXX: Probably okay for newer 2100 f/w too.
1379 */
1380 if (ISP_FW_NEWER_THAN(isp, 2, 26, 0)) {
1381 /*
1382 * Turn on LIP F8 async event (1)
1383 * Turn on generate AE 8013 on all LIP Resets (2)
1384 * Disable LIP F7 switching (8)
1385 */

--- 85 unchanged lines hidden (view full) ---

1471 */
1472
1473static int
1474isp_getmap(struct ispsoftc *isp, fcpos_map_t *map)
1475{
1476 fcparam *fcp = (fcparam *) isp->isp_param;
1477 mbreg_t mbs;
1478
1479 MEMZERO(&mbs, sizeof (mbs));
1460 mbs.param[0] = MBOX_GET_FC_AL_POSITION_MAP;
1461 mbs.param[1] = 0;
1462 mbs.param[2] = DMA_WD1(fcp->isp_scdma);
1463 mbs.param[3] = DMA_WD0(fcp->isp_scdma);
1464 /*
1465 * Unneeded. For the 2100, except for initializing f/w, registers
1466 * 4/5 have to not be written to.
1467 * mbs.param[4] = 0;

--- 25 unchanged lines hidden (view full) ---

1493}
1494
1495static int
1496isp_getpdb(struct ispsoftc *isp, int id, isp_pdb_t *pdbp)
1497{
1498 fcparam *fcp = (fcparam *) isp->isp_param;
1499 mbreg_t mbs;
1500
1480 mbs.param[0] = MBOX_GET_FC_AL_POSITION_MAP;
1481 mbs.param[1] = 0;
1482 mbs.param[2] = DMA_WD1(fcp->isp_scdma);
1483 mbs.param[3] = DMA_WD0(fcp->isp_scdma);
1484 /*
1485 * Unneeded. For the 2100, except for initializing f/w, registers
1486 * 4/5 have to not be written to.
1487 * mbs.param[4] = 0;

--- 25 unchanged lines hidden (view full) ---

1513}
1514
1515static int
1516isp_getpdb(struct ispsoftc *isp, int id, isp_pdb_t *pdbp)
1517{
1518 fcparam *fcp = (fcparam *) isp->isp_param;
1519 mbreg_t mbs;
1520
1521 MEMZERO(&mbs, sizeof (mbs));
1501 mbs.param[0] = MBOX_GET_PORT_DB;
1522 mbs.param[0] = MBOX_GET_PORT_DB;
1502 mbs.param[1] = id << 8;
1523 if (IS_2KLOGIN(isp)) {
1524 mbs.param[1] = id;
1525 mbs.obits |= (1 << 10);
1526 } else {
1527 mbs.param[1] = id << 8;
1528 }
1503 mbs.param[2] = DMA_WD1(fcp->isp_scdma);
1504 mbs.param[3] = DMA_WD0(fcp->isp_scdma);
1505 /*
1506 * Unneeded. For the 2100, except for initializing f/w, registers
1507 * 4/5 have to not be written to.
1508 * mbs.param[4] = 0;
1509 * mbs.param[5] = 0;
1510 *

--- 12 unchanged lines hidden (view full) ---

1523}
1524
1525static u_int64_t
1526isp_get_portname(struct ispsoftc *isp, int loopid, int nodename)
1527{
1528 u_int64_t wwn = 0;
1529 mbreg_t mbs;
1530
1529 mbs.param[2] = DMA_WD1(fcp->isp_scdma);
1530 mbs.param[3] = DMA_WD0(fcp->isp_scdma);
1531 /*
1532 * Unneeded. For the 2100, except for initializing f/w, registers
1533 * 4/5 have to not be written to.
1534 * mbs.param[4] = 0;
1535 * mbs.param[5] = 0;
1536 *

--- 12 unchanged lines hidden (view full) ---

1549}
1550
1551static u_int64_t
1552isp_get_portname(struct ispsoftc *isp, int loopid, int nodename)
1553{
1554 u_int64_t wwn = 0;
1555 mbreg_t mbs;
1556
1557 MEMZERO(&mbs, sizeof (mbs));
1531 mbs.param[0] = MBOX_GET_PORT_NAME;
1558 mbs.param[0] = MBOX_GET_PORT_NAME;
1532 mbs.param[1] = loopid << 8;
1533 if (nodename)
1534 mbs.param[1] |= 1;
1559 if (IS_2KLOGIN(isp)) {
1560 mbs.param[1] = loopid;
1561 if (nodename)
1562 mbs.param[10] = 1;
1563 mbs.obits |= (1 << 10);
1564 } else {
1565 mbs.param[1] = loopid << 8;
1566 if (nodename)
1567 mbs.param[1] |= 1;
1568 }
1535 isp_mboxcmd(isp, &mbs, MBLOGALL & ~MBOX_COMMAND_PARAM_ERROR);
1536 if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
1537 wwn =
1538 (((u_int64_t)(mbs.param[2] & 0xff)) << 56) |
1539 (((u_int64_t)(mbs.param[2] >> 8)) << 48) |
1540 (((u_int64_t)(mbs.param[3] & 0xff)) << 40) |
1541 (((u_int64_t)(mbs.param[3] >> 8)) << 32) |
1542 (((u_int64_t)(mbs.param[6] & 0xff)) << 24) |

--- 99 unchanged lines hidden (view full) ---

1642 */
1643 if (fcp->isp_fwstate != FW_READY) {
1644 return (-1);
1645 }
1646
1647 /*
1648 * Get our Loop ID (if possible). We really need to have it.
1649 */
1569 isp_mboxcmd(isp, &mbs, MBLOGALL & ~MBOX_COMMAND_PARAM_ERROR);
1570 if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
1571 wwn =
1572 (((u_int64_t)(mbs.param[2] & 0xff)) << 56) |
1573 (((u_int64_t)(mbs.param[2] >> 8)) << 48) |
1574 (((u_int64_t)(mbs.param[3] & 0xff)) << 40) |
1575 (((u_int64_t)(mbs.param[3] >> 8)) << 32) |
1576 (((u_int64_t)(mbs.param[6] & 0xff)) << 24) |

--- 99 unchanged lines hidden (view full) ---

1676 */
1677 if (fcp->isp_fwstate != FW_READY) {
1678 return (-1);
1679 }
1680
1681 /*
1682 * Get our Loop ID (if possible). We really need to have it.
1683 */
1684 MEMZERO(&mbs, sizeof (mbs));
1650 mbs.param[0] = MBOX_GET_LOOP_ID;
1651 isp_mboxcmd(isp, &mbs, MBLOGALL);
1652 if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
1653 return (-1);
1654 }
1655 fcp->isp_loopid = mbs.param[1];
1656 if (IS_2200(isp) || IS_23XX(isp)) {
1657 int topo = (int) mbs.param[6];
1658 if (topo < TOPO_NL_PORT || topo > TOPO_PTP_STUB)
1659 topo = TOPO_PTP_STUB;
1660 fcp->isp_topo = topo;
1661 } else {
1662 fcp->isp_topo = TOPO_NL_PORT;
1663 }
1685 mbs.param[0] = MBOX_GET_LOOP_ID;
1686 isp_mboxcmd(isp, &mbs, MBLOGALL);
1687 if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
1688 return (-1);
1689 }
1690 fcp->isp_loopid = mbs.param[1];
1691 if (IS_2200(isp) || IS_23XX(isp)) {
1692 int topo = (int) mbs.param[6];
1693 if (topo < TOPO_NL_PORT || topo > TOPO_PTP_STUB)
1694 topo = TOPO_PTP_STUB;
1695 fcp->isp_topo = topo;
1696 } else {
1697 fcp->isp_topo = TOPO_NL_PORT;
1698 }
1664 fcp->isp_portid = fcp->isp_alpa = mbs.param[2] & 0xff;
1699 /*
1700 * XXX: We can get the AL_PA (low 8 bits) from here.
1701 * XXX: Where do we get the upper 16 bits?
1702 */
1703 fcp->isp_portid = mbs.param[2] & 0xff;
1665
1666 /*
1667 * Check to see if we're on a fabric by trying to see if we
1668 * can talk to the fabric name server. This can be a bit
1669 * tricky because if we're a 2100, we should check always
1670 * (in case we're connected to a server doing aliasing).
1671 */
1672 fcp->isp_onfabric = 0;

--- 74 unchanged lines hidden (view full) ---

1747 if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
1748 if (mbs.param[1] == MBGSD_TWOGB) {
1749 isp_prt(isp, ISP_LOGINFO, "2Gb link speed/s");
1750 fcp->isp_gbspeed = 2;
1751 }
1752 }
1753 }
1754
1704
1705 /*
1706 * Check to see if we're on a fabric by trying to see if we
1707 * can talk to the fabric name server. This can be a bit
1708 * tricky because if we're a 2100, we should check always
1709 * (in case we're connected to a server doing aliasing).
1710 */
1711 fcp->isp_onfabric = 0;

--- 74 unchanged lines hidden (view full) ---

1786 if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
1787 if (mbs.param[1] == MBGSD_TWOGB) {
1788 isp_prt(isp, ISP_LOGINFO, "2Gb link speed/s");
1789 fcp->isp_gbspeed = 2;
1790 }
1791 }
1792 }
1793
1755 isp_prt(isp, ISP_LOGCONFIG, topology, fcp->isp_loopid, fcp->isp_alpa,
1794 isp_prt(isp, ISP_LOGCONFIG, topology, fcp->isp_loopid,
1756 fcp->isp_portid, fcp->isp_loopstate, toponames[fcp->isp_topo]);
1757
1758 /*
1759 * Announce ourselves, too. This involves synthesizing an entry.
1760 */
1761 if (fcp->isp_iid_set == 0) {
1762 fcp->isp_iid_set = 1;
1763 fcp->isp_iid = fcp->isp_loopid;

--- 197 unchanged lines hidden (view full) ---

1961 }
1962
1963 /*
1964 * Force a logout if we were logged in.
1965 */
1966 if (lp->loggedin) {
1967 if (lp->force_logout ||
1968 isp_getpdb(isp, lp->loopid, &pdb) == 0) {
1795 fcp->isp_portid, fcp->isp_loopstate, toponames[fcp->isp_topo]);
1796
1797 /*
1798 * Announce ourselves, too. This involves synthesizing an entry.
1799 */
1800 if (fcp->isp_iid_set == 0) {
1801 fcp->isp_iid_set = 1;
1802 fcp->isp_iid = fcp->isp_loopid;

--- 197 unchanged lines hidden (view full) ---

2000 }
2001
2002 /*
2003 * Force a logout if we were logged in.
2004 */
2005 if (lp->loggedin) {
2006 if (lp->force_logout ||
2007 isp_getpdb(isp, lp->loopid, &pdb) == 0) {
2008 MEMZERO(&mbs, sizeof (mbs));
1969 mbs.param[0] = MBOX_FABRIC_LOGOUT;
2009 mbs.param[0] = MBOX_FABRIC_LOGOUT;
1970 mbs.param[1] = lp->loopid << 8;
2010 if (IS_2KLOGIN(isp)) {
2011 mbs.param[1] = lp->loopid;
2012 mbs.obits |= (1 << 10);
2013 } else {
2014 mbs.param[1] = lp->loopid << 8;
2015 }
1971 mbs.param[2] = 0;
1972 mbs.param[3] = 0;
1973 isp_mboxcmd(isp, &mbs, MBLOGNONE);
1974 isp_prt(isp, ISP_LOGINFO, plogout,
1975 (int) (lp - fcp->portdb), lp->loopid,
1976 lp->portid);
1977 }
1978 lp->force_logout = lp->loggedin = 0;

--- 4 unchanged lines hidden (view full) ---

1983 }
1984
1985 /*
1986 * And log in....
1987 */
1988 loopid = lp - fcp->portdb;
1989 lp->loopid = FL_PORT_ID;
1990 do {
2016 mbs.param[2] = 0;
2017 mbs.param[3] = 0;
2018 isp_mboxcmd(isp, &mbs, MBLOGNONE);
2019 isp_prt(isp, ISP_LOGINFO, plogout,
2020 (int) (lp - fcp->portdb), lp->loopid,
2021 lp->portid);
2022 }
2023 lp->force_logout = lp->loggedin = 0;

--- 4 unchanged lines hidden (view full) ---

2028 }
2029
2030 /*
2031 * And log in....
2032 */
2033 loopid = lp - fcp->portdb;
2034 lp->loopid = FL_PORT_ID;
2035 do {
2036 MEMZERO(&mbs, sizeof (mbs));
1991 mbs.param[0] = MBOX_FABRIC_LOGIN;
2037 mbs.param[0] = MBOX_FABRIC_LOGIN;
1992 mbs.param[1] = loopid << 8;
2038 if (IS_2KLOGIN(isp)) {
2039 mbs.param[1] = loopid;
2040 mbs.obits |= (1 << 10);
2041 } else {
2042 mbs.param[1] = loopid << 8;
2043 }
1993 mbs.param[2] = portid >> 16;
1994 mbs.param[3] = portid & 0xffff;
1995 isp_mboxcmd(isp, &mbs, MBLOGALL & ~(MBOX_LOOP_ID_USED |
1996 MBOX_PORT_ID_USED | MBOX_COMMAND_ERROR));
1997 if (fcp->isp_fwstate != FW_READY ||
1998 fcp->isp_loopstate != LOOP_SYNCING_PDB) {
1999 return (-1);
2000 }

--- 98 unchanged lines hidden (view full) ---

2099 loopid = lp - fcp->portdb;
2100 (void) isp_async(isp, ISPASYNC_PROMENADE, &loopid);
2101 continue;
2102 }
2103dump_em:
2104 lp->valid = 0;
2105 isp_prt(isp, ISP_LOGINFO,
2106 ldumped, loopid, lp->loopid, lp->portid);
2044 mbs.param[2] = portid >> 16;
2045 mbs.param[3] = portid & 0xffff;
2046 isp_mboxcmd(isp, &mbs, MBLOGALL & ~(MBOX_LOOP_ID_USED |
2047 MBOX_PORT_ID_USED | MBOX_COMMAND_ERROR));
2048 if (fcp->isp_fwstate != FW_READY ||
2049 fcp->isp_loopstate != LOOP_SYNCING_PDB) {
2050 return (-1);
2051 }

--- 98 unchanged lines hidden (view full) ---

2150 loopid = lp - fcp->portdb;
2151 (void) isp_async(isp, ISPASYNC_PROMENADE, &loopid);
2152 continue;
2153 }
2154dump_em:
2155 lp->valid = 0;
2156 isp_prt(isp, ISP_LOGINFO,
2157 ldumped, loopid, lp->loopid, lp->portid);
2158 MEMZERO(&mbs, sizeof (mbs));
2107 mbs.param[0] = MBOX_FABRIC_LOGOUT;
2159 mbs.param[0] = MBOX_FABRIC_LOGOUT;
2108 mbs.param[1] = lp->loopid << 8;
2109 mbs.param[2] = 0;
2110 mbs.param[3] = 0;
2160 if (IS_2KLOGIN(isp)) {
2161 mbs.param[1] = lp->loopid;
2162 mbs.obits |= (1 << 10);
2163 } else {
2164 mbs.param[1] = lp->loopid << 8;
2165 }
2111 isp_mboxcmd(isp, &mbs, MBLOGNONE);
2112 if (fcp->isp_fwstate != FW_READY ||
2113 fcp->isp_loopstate != LOOP_SYNCING_PDB) {
2114 return (-1);
2115 }
2116 }
2117 /*
2118 * If we get here, we've for sure seen not only a valid loop

--- 364 unchanged lines hidden (view full) ---

2483 rq->snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma+0x100);
2484 rq->snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma+0x100);
2485 rq->snscb_sblen = 6;
2486 rq->snscb_data[0] = SNS_GA_NXT;
2487 rq->snscb_data[4] = portid & 0xffff;
2488 rq->snscb_data[5] = (portid >> 16) & 0xff;
2489 isp_put_sns_request(isp, rq, (sns_screq_t *) fcp->isp_scratch);
2490 MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GA_NXT_REQ_SIZE);
2166 isp_mboxcmd(isp, &mbs, MBLOGNONE);
2167 if (fcp->isp_fwstate != FW_READY ||
2168 fcp->isp_loopstate != LOOP_SYNCING_PDB) {
2169 return (-1);
2170 }
2171 }
2172 /*
2173 * If we get here, we've for sure seen not only a valid loop

--- 364 unchanged lines hidden (view full) ---

2538 rq->snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma+0x100);
2539 rq->snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma+0x100);
2540 rq->snscb_sblen = 6;
2541 rq->snscb_data[0] = SNS_GA_NXT;
2542 rq->snscb_data[4] = portid & 0xffff;
2543 rq->snscb_data[5] = (portid >> 16) & 0xff;
2544 isp_put_sns_request(isp, rq, (sns_screq_t *) fcp->isp_scratch);
2545 MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GA_NXT_REQ_SIZE);
2546 MEMZERO(&mbs, sizeof (mbs));
2491 mbs.param[0] = MBOX_SEND_SNS;
2492 mbs.param[1] = SNS_GA_NXT_REQ_SIZE >> 1;
2493 mbs.param[2] = DMA_WD1(fcp->isp_scdma);
2494 mbs.param[3] = DMA_WD0(fcp->isp_scdma);
2495 /*
2496 * Leave 4 and 5 alone
2497 */
2498 mbs.param[6] = DMA_WD3(fcp->isp_scdma);

--- 134 unchanged lines hidden (view full) ---

2633 rq->snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma+IGPOFF);
2634 rq->snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma+IGPOFF);
2635 rq->snscb_sblen = 6;
2636 rq->snscb_cmd = SNS_GID_FT;
2637 rq->snscb_mword_div_2 = NGENT;
2638 rq->snscb_fc4_type = ftype;
2639 isp_put_gid_ft_request(isp, rq, (sns_gid_ft_req_t *) fcp->isp_scratch);
2640 MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GID_FT_REQ_SIZE);
2547 mbs.param[0] = MBOX_SEND_SNS;
2548 mbs.param[1] = SNS_GA_NXT_REQ_SIZE >> 1;
2549 mbs.param[2] = DMA_WD1(fcp->isp_scdma);
2550 mbs.param[3] = DMA_WD0(fcp->isp_scdma);
2551 /*
2552 * Leave 4 and 5 alone
2553 */
2554 mbs.param[6] = DMA_WD3(fcp->isp_scdma);

--- 134 unchanged lines hidden (view full) ---

2689 rq->snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma+IGPOFF);
2690 rq->snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma+IGPOFF);
2691 rq->snscb_sblen = 6;
2692 rq->snscb_cmd = SNS_GID_FT;
2693 rq->snscb_mword_div_2 = NGENT;
2694 rq->snscb_fc4_type = ftype;
2695 isp_put_gid_ft_request(isp, rq, (sns_gid_ft_req_t *) fcp->isp_scratch);
2696 MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GID_FT_REQ_SIZE);
2697 MEMZERO(&mbs, sizeof (mbs));
2641 mbs.param[0] = MBOX_SEND_SNS;
2642 mbs.param[1] = SNS_GID_FT_REQ_SIZE >> 1;
2643 mbs.param[2] = DMA_WD1(fcp->isp_scdma);
2644 mbs.param[3] = DMA_WD0(fcp->isp_scdma);
2645
2646 /*
2647 * Leave 4 and 5 alone
2648 */

--- 61 unchanged lines hidden (view full) ---

2710 gq->snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma+GXOFF);
2711 gq->snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma+GXOFF);
2712 gq->snscb_sblen = 6;
2713 gq->snscb_cmd = SNS_GPN_ID;
2714 gq->snscb_portid = lcl.portid;
2715 isp_put_gxn_id_request(isp, gq,
2716 (sns_gxn_id_req_t *) fcp->isp_scratch);
2717 MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GXN_ID_REQ_SIZE);
2698 mbs.param[0] = MBOX_SEND_SNS;
2699 mbs.param[1] = SNS_GID_FT_REQ_SIZE >> 1;
2700 mbs.param[2] = DMA_WD1(fcp->isp_scdma);
2701 mbs.param[3] = DMA_WD0(fcp->isp_scdma);
2702
2703 /*
2704 * Leave 4 and 5 alone
2705 */

--- 61 unchanged lines hidden (view full) ---

2767 gq->snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma+GXOFF);
2768 gq->snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma+GXOFF);
2769 gq->snscb_sblen = 6;
2770 gq->snscb_cmd = SNS_GPN_ID;
2771 gq->snscb_portid = lcl.portid;
2772 isp_put_gxn_id_request(isp, gq,
2773 (sns_gxn_id_req_t *) fcp->isp_scratch);
2774 MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GXN_ID_REQ_SIZE);
2775 MEMZERO(&mbs, sizeof (mbs));
2718 mbs.param[0] = MBOX_SEND_SNS;
2719 mbs.param[1] = SNS_GXN_ID_REQ_SIZE >> 1;
2720 mbs.param[2] = DMA_WD1(fcp->isp_scdma);
2721 mbs.param[3] = DMA_WD0(fcp->isp_scdma);
2722 /*
2723 * Leave 4 and 5 alone
2724 */
2725 mbs.param[6] = DMA_WD3(fcp->isp_scdma);

--- 39 unchanged lines hidden (view full) ---

2765 gq->snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma+GXOFF);
2766 gq->snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma+GXOFF);
2767 gq->snscb_sblen = 6;
2768 gq->snscb_cmd = SNS_GNN_ID;
2769 gq->snscb_portid = lcl.portid;
2770 isp_put_gxn_id_request(isp, gq,
2771 (sns_gxn_id_req_t *) fcp->isp_scratch);
2772 MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GXN_ID_REQ_SIZE);
2776 mbs.param[0] = MBOX_SEND_SNS;
2777 mbs.param[1] = SNS_GXN_ID_REQ_SIZE >> 1;
2778 mbs.param[2] = DMA_WD1(fcp->isp_scdma);
2779 mbs.param[3] = DMA_WD0(fcp->isp_scdma);
2780 /*
2781 * Leave 4 and 5 alone
2782 */
2783 mbs.param[6] = DMA_WD3(fcp->isp_scdma);

--- 39 unchanged lines hidden (view full) ---

2823 gq->snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma+GXOFF);
2824 gq->snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma+GXOFF);
2825 gq->snscb_sblen = 6;
2826 gq->snscb_cmd = SNS_GNN_ID;
2827 gq->snscb_portid = lcl.portid;
2828 isp_put_gxn_id_request(isp, gq,
2829 (sns_gxn_id_req_t *) fcp->isp_scratch);
2830 MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GXN_ID_REQ_SIZE);
2831 MEMZERO(&mbs, sizeof (mbs));
2773 mbs.param[0] = MBOX_SEND_SNS;
2774 mbs.param[1] = SNS_GXN_ID_REQ_SIZE >> 1;
2775 mbs.param[2] = DMA_WD1(fcp->isp_scdma);
2776 mbs.param[3] = DMA_WD0(fcp->isp_scdma);
2777 /*
2778 * Leave 4 and 5 alone
2779 */
2780 mbs.param[6] = DMA_WD3(fcp->isp_scdma);

--- 47 unchanged lines hidden (view full) ---

2828 gq->snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma+GXOFF);
2829 gq->snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma+GXOFF);
2830 gq->snscb_sblen = 6;
2831 gq->snscb_cmd = SNS_GFF_ID;
2832 gq->snscb_portid = lcl.portid;
2833 isp_put_gxn_id_request(isp, gq,
2834 (sns_gxn_id_req_t *) fcp->isp_scratch);
2835 MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GXN_ID_REQ_SIZE);
2832 mbs.param[0] = MBOX_SEND_SNS;
2833 mbs.param[1] = SNS_GXN_ID_REQ_SIZE >> 1;
2834 mbs.param[2] = DMA_WD1(fcp->isp_scdma);
2835 mbs.param[3] = DMA_WD0(fcp->isp_scdma);
2836 /*
2837 * Leave 4 and 5 alone
2838 */
2839 mbs.param[6] = DMA_WD3(fcp->isp_scdma);

--- 47 unchanged lines hidden (view full) ---

2887 gq->snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma+GXOFF);
2888 gq->snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma+GXOFF);
2889 gq->snscb_sblen = 6;
2890 gq->snscb_cmd = SNS_GFF_ID;
2891 gq->snscb_portid = lcl.portid;
2892 isp_put_gxn_id_request(isp, gq,
2893 (sns_gxn_id_req_t *) fcp->isp_scratch);
2894 MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GXN_ID_REQ_SIZE);
2895 MEMZERO(&mbs, sizeof (mbs));
2836 mbs.param[0] = MBOX_SEND_SNS;
2837 mbs.param[1] = SNS_GXN_ID_REQ_SIZE >> 1;
2838 mbs.param[2] = DMA_WD1(fcp->isp_scdma);
2839 mbs.param[3] = DMA_WD0(fcp->isp_scdma);
2840 /*
2841 * Leave 4 and 5 alone
2842 */
2843 mbs.param[6] = DMA_WD3(fcp->isp_scdma);

--- 85 unchanged lines hidden (view full) ---

2929 reqp->snscb_data[4] = fcp->isp_portid & 0xffff;
2930 reqp->snscb_data[5] = (fcp->isp_portid >> 16) & 0xff;
2931 reqp->snscb_data[6] = (1 << FC4_SCSI);
2932#if 0
2933 reqp->snscb_data[6] |= (1 << FC4_IP); /* ISO/IEC 8802-2 LLC/SNAP */
2934#endif
2935 FC_SCRATCH_ACQUIRE(isp);
2936 isp_put_sns_request(isp, reqp, (sns_screq_t *) fcp->isp_scratch);
2896 mbs.param[0] = MBOX_SEND_SNS;
2897 mbs.param[1] = SNS_GXN_ID_REQ_SIZE >> 1;
2898 mbs.param[2] = DMA_WD1(fcp->isp_scdma);
2899 mbs.param[3] = DMA_WD0(fcp->isp_scdma);
2900 /*
2901 * Leave 4 and 5 alone
2902 */
2903 mbs.param[6] = DMA_WD3(fcp->isp_scdma);

--- 85 unchanged lines hidden (view full) ---

2989 reqp->snscb_data[4] = fcp->isp_portid & 0xffff;
2990 reqp->snscb_data[5] = (fcp->isp_portid >> 16) & 0xff;
2991 reqp->snscb_data[6] = (1 << FC4_SCSI);
2992#if 0
2993 reqp->snscb_data[6] |= (1 << FC4_IP); /* ISO/IEC 8802-2 LLC/SNAP */
2994#endif
2995 FC_SCRATCH_ACQUIRE(isp);
2996 isp_put_sns_request(isp, reqp, (sns_screq_t *) fcp->isp_scratch);
2997 MEMZERO(&mbs, sizeof (mbs));
2937 mbs.param[0] = MBOX_SEND_SNS;
2938 mbs.param[1] = SNS_RFT_ID_REQ_SIZE >> 1;
2939 mbs.param[2] = DMA_WD1(fcp->isp_scdma);
2940 mbs.param[3] = DMA_WD0(fcp->isp_scdma);
2941 /*
2942 * Leave 4 and 5 alone
2943 */
2944 mbs.param[6] = DMA_WD3(fcp->isp_scdma);

--- 323 unchanged lines hidden (view full) ---

3268 } else {
3269 sdparam *sdp = (sdparam *)isp->isp_param;
3270 sdp += XS_CHANNEL(xs);
3271 if ((sdp->isp_devparam[target].actv_flags & DPARM_TQING) &&
3272 XS_TAG_P(xs)) {
3273 reqp->req_flags = XS_TAG_TYPE(xs);
3274 }
3275 }
2998 mbs.param[0] = MBOX_SEND_SNS;
2999 mbs.param[1] = SNS_RFT_ID_REQ_SIZE >> 1;
3000 mbs.param[2] = DMA_WD1(fcp->isp_scdma);
3001 mbs.param[3] = DMA_WD0(fcp->isp_scdma);
3002 /*
3003 * Leave 4 and 5 alone
3004 */
3005 mbs.param[6] = DMA_WD3(fcp->isp_scdma);

--- 323 unchanged lines hidden (view full) ---

3329 } else {
3330 sdparam *sdp = (sdparam *)isp->isp_param;
3331 sdp += XS_CHANNEL(xs);
3332 if ((sdp->isp_devparam[target].actv_flags & DPARM_TQING) &&
3333 XS_TAG_P(xs)) {
3334 reqp->req_flags = XS_TAG_TYPE(xs);
3335 }
3336 }
3276 reqp->req_target = target | (XS_CHANNEL(xs) << 7);
3277 if (IS_SCSI(isp)) {
3337 if (IS_SCSI(isp)) {
3338 reqp->req_target = target | (XS_CHANNEL(xs) << 7);
3278 reqp->req_lun_trn = XS_LUN(xs);
3279 reqp->req_cdblen = XS_CDBLEN(xs);
3339 reqp->req_lun_trn = XS_LUN(xs);
3340 reqp->req_cdblen = XS_CDBLEN(xs);
3341 } else if (IS_2KLOGIN(isp)) {
3342 ((ispreqt2e_t *)reqp)->req_target = target;
3343 ((ispreqt2e_t *)reqp)->req_scclun = XS_LUN(xs);
3344 } else if (FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) {
3345 ((ispreqt2_t *)reqp)->req_target = target;
3346 ((ispreqt2_t *)reqp)->req_scclun = XS_LUN(xs);
3280 } else {
3347 } else {
3281 if (FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN)
3282 ((ispreqt2_t *)reqp)->req_scclun = XS_LUN(xs);
3283 else
3284 ((ispreqt2_t *)reqp)->req_lun_trn = XS_LUN(xs);
3348 ((ispreqt2_t *)reqp)->req_target = target;
3349 ((ispreqt2_t *)reqp)->req_lun_trn = XS_LUN(xs);
3285 }
3286 MEMCPY(reqp->req_cdb, XS_CDBP(xs), XS_CDBLEN(xs));
3287
3288 reqp->req_time = XS_TIME(xs) / 1000;
3289 if (reqp->req_time == 0 && XS_TIME(xs)) {
3290 reqp->req_time = 1;
3291 }
3292

--- 35 unchanged lines hidden (view full) ---

3328int
3329isp_control(struct ispsoftc *isp, ispctl_t ctl, void *arg)
3330{
3331 XS_T *xs;
3332 mbreg_t mbs;
3333 int bus, tgt;
3334 u_int16_t handle;
3335
3350 }
3351 MEMCPY(reqp->req_cdb, XS_CDBP(xs), XS_CDBLEN(xs));
3352
3353 reqp->req_time = XS_TIME(xs) / 1000;
3354 if (reqp->req_time == 0 && XS_TIME(xs)) {
3355 reqp->req_time = 1;
3356 }
3357

--- 35 unchanged lines hidden (view full) ---

3393int
3394isp_control(struct ispsoftc *isp, ispctl_t ctl, void *arg)
3395{
3396 XS_T *xs;
3397 mbreg_t mbs;
3398 int bus, tgt;
3399 u_int16_t handle;
3400
3401 MEMZERO(&mbs, sizeof (mbs));
3402
3336 switch (ctl) {
3337 default:
3338 isp_prt(isp, ISP_LOGERR, "Unknown Control Opcode 0x%x", ctl);
3339 break;
3340
3341 case ISPCTL_RESET_BUS:
3342 /*
3343 * Issue a bus reset.

--- 20 unchanged lines hidden (view full) ---

3364 isp_prt(isp, ISP_LOGINFO,
3365 "driver initiated bus reset of bus %d", bus);
3366 return (0);
3367
3368 case ISPCTL_RESET_DEV:
3369 tgt = (*((int *) arg)) & 0xffff;
3370 bus = (*((int *) arg)) >> 16;
3371 mbs.param[0] = MBOX_ABORT_TARGET;
3403 switch (ctl) {
3404 default:
3405 isp_prt(isp, ISP_LOGERR, "Unknown Control Opcode 0x%x", ctl);
3406 break;
3407
3408 case ISPCTL_RESET_BUS:
3409 /*
3410 * Issue a bus reset.

--- 20 unchanged lines hidden (view full) ---

3431 isp_prt(isp, ISP_LOGINFO,
3432 "driver initiated bus reset of bus %d", bus);
3433 return (0);
3434
3435 case ISPCTL_RESET_DEV:
3436 tgt = (*((int *) arg)) & 0xffff;
3437 bus = (*((int *) arg)) >> 16;
3438 mbs.param[0] = MBOX_ABORT_TARGET;
3372 mbs.param[1] = (tgt << 8) | (bus << 15);
3439 if (IS_SCSI(isp)) {
3440 mbs.param[1] = (tgt << 8) | (bus << 15);
3441 } else {
3442 if (IS_2KLOGIN(isp)) {
3443 mbs.param[1] = tgt;
3444 mbs.obits |= (1 << 10);
3445 } else {
3446 mbs.param[1] = (tgt << 8);
3447 }
3448 }
3373 mbs.param[2] = 3; /* 'delay', in seconds */
3374 isp_mboxcmd(isp, &mbs, MBLOGALL);
3375 if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
3376 break;
3377 }
3378 isp_prt(isp, ISP_LOGINFO,
3379 "Target %d on Bus %d Reset Succeeded", tgt, bus);
3380 isp->isp_sendmarker |= (1 << bus);

--- 7 unchanged lines hidden (view full) ---

3388 isp_prt(isp, ISP_LOGWARN,
3389 "cannot find handle for command to abort");
3390 break;
3391 }
3392 bus = XS_CHANNEL(xs);
3393 mbs.param[0] = MBOX_ABORT;
3394 if (IS_FC(isp)) {
3395 if (FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) {
3449 mbs.param[2] = 3; /* 'delay', in seconds */
3450 isp_mboxcmd(isp, &mbs, MBLOGALL);
3451 if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
3452 break;
3453 }
3454 isp_prt(isp, ISP_LOGINFO,
3455 "Target %d on Bus %d Reset Succeeded", tgt, bus);
3456 isp->isp_sendmarker |= (1 << bus);

--- 7 unchanged lines hidden (view full) ---

3464 isp_prt(isp, ISP_LOGWARN,
3465 "cannot find handle for command to abort");
3466 break;
3467 }
3468 bus = XS_CHANNEL(xs);
3469 mbs.param[0] = MBOX_ABORT;
3470 if (IS_FC(isp)) {
3471 if (FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) {
3396 mbs.param[1] = tgt << 8;
3472 if (IS_2KLOGIN(isp)) {
3473 mbs.param[1] = tgt;
3474 } else {
3475 mbs.param[1] = tgt << 8;
3476 }
3397 mbs.param[4] = 0;
3398 mbs.param[5] = 0;
3399 mbs.param[6] = XS_LUN(xs);
3400 } else {
3401 mbs.param[1] = tgt << 8 | XS_LUN(xs);
3402 }
3403 } else {
3404 mbs.param[1] =

--- 131 unchanged lines hidden (view full) ---

3536 * The mailbox semaphore will be nonzero if so.
3537 */
3538 if (sema) {
3539 if (mbox & 0x4000) {
3540 isp->isp_intmboxc++;
3541 if (isp->isp_mboxbsy) {
3542 int i = 0, obits = isp->isp_obits;
3543 isp->isp_mboxtmp[i++] = mbox;
3477 mbs.param[4] = 0;
3478 mbs.param[5] = 0;
3479 mbs.param[6] = XS_LUN(xs);
3480 } else {
3481 mbs.param[1] = tgt << 8 | XS_LUN(xs);
3482 }
3483 } else {
3484 mbs.param[1] =

--- 131 unchanged lines hidden (view full) ---

3616 * The mailbox semaphore will be nonzero if so.
3617 */
3618 if (sema) {
3619 if (mbox & 0x4000) {
3620 isp->isp_intmboxc++;
3621 if (isp->isp_mboxbsy) {
3622 int i = 0, obits = isp->isp_obits;
3623 isp->isp_mboxtmp[i++] = mbox;
3544 for (i = 1; i < MAX_MAILBOX; i++) {
3624 for (i = 1; i < MAX_MAILBOX(isp); i++) {
3545 if ((obits & (1 << i)) == 0) {
3546 continue;
3547 }
3548 isp->isp_mboxtmp[i] =
3549 ISP_READ(isp, MBOX_OFF(i));
3550 }
3551 if (isp->isp_mbxwrk0) {
3552 if (isp_mbox_continue(isp) == 0) {

--- 587 unchanged lines hidden (view full) ---

4140#else
4141 isp_prt(isp, ISP_LOGINFO, "Fast Posting CTIO done");
4142 isp->isp_fphccmplt++; /* count it as a fast posting intr */
4143#endif
4144 break;
4145 }
4146 case ASYNC_LIP_F8:
4147 case ASYNC_LIP_OCCURRED:
3625 if ((obits & (1 << i)) == 0) {
3626 continue;
3627 }
3628 isp->isp_mboxtmp[i] =
3629 ISP_READ(isp, MBOX_OFF(i));
3630 }
3631 if (isp->isp_mbxwrk0) {
3632 if (isp_mbox_continue(isp) == 0) {

--- 587 unchanged lines hidden (view full) ---

4220#else
4221 isp_prt(isp, ISP_LOGINFO, "Fast Posting CTIO done");
4222 isp->isp_fphccmplt++; /* count it as a fast posting intr */
4223#endif
4224 break;
4225 }
4226 case ASYNC_LIP_F8:
4227 case ASYNC_LIP_OCCURRED:
4148 FCPARAM(isp)->isp_lipseq =
4149 ISP_READ(isp, OUTMAILBOX1);
4150 FCPARAM(isp)->isp_fwstate = FW_CONFIG_WAIT;
4151 FCPARAM(isp)->isp_loopstate = LOOP_LIP_RCVD;
4152 isp->isp_sendmarker = 1;
4153 isp_mark_getpdb_all(isp);
4154 isp_async(isp, ISPASYNC_LIP, NULL);
4155#ifdef ISP_TARGET_MODE
4156 if (isp_target_async(isp, bus, mbox))
4157 rval = -1;

--- 137 unchanged lines hidden (view full) ---

4295 isp_prt(isp, ISP_LOGWARN, "Unknown Async Code 0x%x", mbox);
4296 break;
4297 }
4298
4299 if (bus & 0x100) {
4300 int i, nh;
4301 u_int16_t handles[16];
4302
4228 FCPARAM(isp)->isp_fwstate = FW_CONFIG_WAIT;
4229 FCPARAM(isp)->isp_loopstate = LOOP_LIP_RCVD;
4230 isp->isp_sendmarker = 1;
4231 isp_mark_getpdb_all(isp);
4232 isp_async(isp, ISPASYNC_LIP, NULL);
4233#ifdef ISP_TARGET_MODE
4234 if (isp_target_async(isp, bus, mbox))
4235 rval = -1;

--- 137 unchanged lines hidden (view full) ---

4373 isp_prt(isp, ISP_LOGWARN, "Unknown Async Code 0x%x", mbox);
4374 break;
4375 }
4376
4377 if (bus & 0x100) {
4378 int i, nh;
4379 u_int16_t handles[16];
4380
4303 for (nh = 0, i = 1; i < MAX_MAILBOX; i++) {
4381 for (nh = 0, i = 1; i < MAX_MAILBOX(isp); i++) {
4304 if ((bus & (1 << i)) == 0) {
4305 continue;
4306 }
4307 handles[nh++] = ISP_READ(isp, MBOX_OFF(i));
4308 }
4309 for (i = 0; i < nh; i++) {
4310 isp_fastpost_complete(isp, handles[i]);
4311 isp_prt(isp, ISP_LOGDEBUG3,

--- 399 unchanged lines hidden (view full) ---

4711 /*
4712 * If we're on a local loop, force a LIP (which is overkill)
4713 * to force a re-login of this unit. If we're on fabric,
4714 * then we'll have to relogin as a matter of course.
4715 */
4716 if (FCPARAM(isp)->isp_topo == TOPO_NL_PORT ||
4717 FCPARAM(isp)->isp_topo == TOPO_FL_PORT) {
4718 mbreg_t mbs;
4382 if ((bus & (1 << i)) == 0) {
4383 continue;
4384 }
4385 handles[nh++] = ISP_READ(isp, MBOX_OFF(i));
4386 }
4387 for (i = 0; i < nh; i++) {
4388 isp_fastpost_complete(isp, handles[i]);
4389 isp_prt(isp, ISP_LOGDEBUG3,

--- 399 unchanged lines hidden (view full) ---

4789 /*
4790 * If we're on a local loop, force a LIP (which is overkill)
4791 * to force a re-login of this unit. If we're on fabric,
4792 * then we'll have to relogin as a matter of course.
4793 */
4794 if (FCPARAM(isp)->isp_topo == TOPO_NL_PORT ||
4795 FCPARAM(isp)->isp_topo == TOPO_FL_PORT) {
4796 mbreg_t mbs;
4797 MEMZERO(&mbs, sizeof (mbs));
4719 mbs.param[0] = MBOX_INIT_LIP;
4720 isp_mboxcmd_qnw(isp, &mbs, 1);
4721 }
4722
4723 /*
4724 * Probably overkill.
4725 */
4726 isp->isp_sendmarker = 1;

--- 78 unchanged lines hidden (view full) ---

4805 default:
4806 return (1);
4807 }
4808 if (isp->isp_mboxtmp[0] != MBOX_COMMAND_COMPLETE) {
4809 isp->isp_mbxwrk0 = 0;
4810 return (-1);
4811 }
4812
4798 mbs.param[0] = MBOX_INIT_LIP;
4799 isp_mboxcmd_qnw(isp, &mbs, 1);
4800 }
4801
4802 /*
4803 * Probably overkill.
4804 */
4805 isp->isp_sendmarker = 1;

--- 78 unchanged lines hidden (view full) ---

4884 default:
4885 return (1);
4886 }
4887 if (isp->isp_mboxtmp[0] != MBOX_COMMAND_COMPLETE) {
4888 isp->isp_mbxwrk0 = 0;
4889 return (-1);
4890 }
4891
4813
4814 /*
4815 * Clear the previous interrupt.
4816 */
4817 ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT);
4818 ISP_WRITE(isp, BIU_SEMA, 0);
4819
4820 /*
4821 * Continue with next word.
4822 */
4892 /*
4893 * Clear the previous interrupt.
4894 */
4895 ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT);
4896 ISP_WRITE(isp, BIU_SEMA, 0);
4897
4898 /*
4899 * Continue with next word.
4900 */
4901 MEMZERO(&mbs, sizeof (mbs));
4823 ptr = isp->isp_mbxworkp;
4824 switch (isp->isp_lastmbxcmd) {
4825 case MBOX_WRITE_RAM_WORD:
4826 mbs.param[2] = *ptr++;
4827 mbs.param[1] = isp->isp_mbxwrk1++;
4828 break;
4829 case MBOX_READ_RAM_WORD:
4830 case MBOX_READ_RAM_WORD_EXTENDED:

--- 4 unchanged lines hidden (view full) ---

4835 isp->isp_mbxworkp = ptr;
4836 mbs.param[0] = isp->isp_lastmbxcmd;
4837 isp->isp_mbxwrk0 -= 1;
4838 isp_mboxcmd_qnw(isp, &mbs, 0);
4839 return (0);
4840}
4841
4842
4902 ptr = isp->isp_mbxworkp;
4903 switch (isp->isp_lastmbxcmd) {
4904 case MBOX_WRITE_RAM_WORD:
4905 mbs.param[2] = *ptr++;
4906 mbs.param[1] = isp->isp_mbxwrk1++;
4907 break;
4908 case MBOX_READ_RAM_WORD:
4909 case MBOX_READ_RAM_WORD_EXTENDED:

--- 4 unchanged lines hidden (view full) ---

4914 isp->isp_mbxworkp = ptr;
4915 mbs.param[0] = isp->isp_lastmbxcmd;
4916 isp->isp_mbxwrk0 -= 1;
4917 isp_mboxcmd_qnw(isp, &mbs, 0);
4918 return (0);
4919}
4920
4921
4843#define HIBYT(x) ((x) >> 0x8)
4844#define LOBYT(x) ((x) & 0xff)
4845#define ISPOPMAP(a, b) (((a) << 8) | (b))
4846static const u_int16_t mbpscsi[] = {
4922#define HIWRD(x) ((x) >> 16)
4923#define LOWRD(x) ((x) & 0xffff)
4924#define ISPOPMAP(a, b) (((a) << 16) | (b))
4925static const u_int32_t mbpscsi[] = {
4847 ISPOPMAP(0x01, 0x01), /* 0x00: MBOX_NO_OP */
4848 ISPOPMAP(0x1f, 0x01), /* 0x01: MBOX_LOAD_RAM */
4849 ISPOPMAP(0x03, 0x01), /* 0x02: MBOX_EXEC_FIRMWARE */
4850 ISPOPMAP(0x1f, 0x01), /* 0x03: MBOX_DUMP_RAM */
4851 ISPOPMAP(0x07, 0x07), /* 0x04: MBOX_WRITE_RAM_WORD */
4852 ISPOPMAP(0x03, 0x07), /* 0x05: MBOX_READ_RAM_WORD */
4853 ISPOPMAP(0x3f, 0x3f), /* 0x06: MBOX_MAILBOX_REG_TEST */
4854 ISPOPMAP(0x03, 0x07), /* 0x07: MBOX_VERIFY_CHECKSUM */

--- 179 unchanged lines hidden (view full) ---

5034 NULL,
5035 "SET DATA OVERRUN RECOVERY MODE",
5036 "GET DATA OVERRUN RECOVERY MODE",
5037 "SET HOST DATA",
5038 "GET NOST DATA",
5039};
5040#endif
5041
4926 ISPOPMAP(0x01, 0x01), /* 0x00: MBOX_NO_OP */
4927 ISPOPMAP(0x1f, 0x01), /* 0x01: MBOX_LOAD_RAM */
4928 ISPOPMAP(0x03, 0x01), /* 0x02: MBOX_EXEC_FIRMWARE */
4929 ISPOPMAP(0x1f, 0x01), /* 0x03: MBOX_DUMP_RAM */
4930 ISPOPMAP(0x07, 0x07), /* 0x04: MBOX_WRITE_RAM_WORD */
4931 ISPOPMAP(0x03, 0x07), /* 0x05: MBOX_READ_RAM_WORD */
4932 ISPOPMAP(0x3f, 0x3f), /* 0x06: MBOX_MAILBOX_REG_TEST */
4933 ISPOPMAP(0x03, 0x07), /* 0x07: MBOX_VERIFY_CHECKSUM */

--- 179 unchanged lines hidden (view full) ---

5113 NULL,
5114 "SET DATA OVERRUN RECOVERY MODE",
5115 "GET DATA OVERRUN RECOVERY MODE",
5116 "SET HOST DATA",
5117 "GET NOST DATA",
5118};
5119#endif
5120
5042static const u_int16_t mbpfc[] = {
5121static const u_int32_t mbpfc[] = {
5043 ISPOPMAP(0x01, 0x01), /* 0x00: MBOX_NO_OP */
5044 ISPOPMAP(0x1f, 0x01), /* 0x01: MBOX_LOAD_RAM */
5045 ISPOPMAP(0x03, 0x01), /* 0x02: MBOX_EXEC_FIRMWARE */
5046 ISPOPMAP(0xdf, 0x01), /* 0x03: MBOX_DUMP_RAM */
5047 ISPOPMAP(0x07, 0x07), /* 0x04: MBOX_WRITE_RAM_WORD */
5048 ISPOPMAP(0x03, 0x07), /* 0x05: MBOX_READ_RAM_WORD */
5049 ISPOPMAP(0xff, 0xff), /* 0x06: MBOX_MAILBOX_REG_TEST */
5050 ISPOPMAP(0x03, 0x05), /* 0x07: MBOX_VERIFY_CHECKSUM */

--- 256 unchanged lines hidden (view full) ---

5307 "Lun RESET"
5308};
5309#endif
5310
5311static void
5312isp_mboxcmd_qnw(struct ispsoftc *isp, mbreg_t *mbp, int nodelay)
5313{
5314 unsigned int ibits, obits, box, opcode;
5122 ISPOPMAP(0x01, 0x01), /* 0x00: MBOX_NO_OP */
5123 ISPOPMAP(0x1f, 0x01), /* 0x01: MBOX_LOAD_RAM */
5124 ISPOPMAP(0x03, 0x01), /* 0x02: MBOX_EXEC_FIRMWARE */
5125 ISPOPMAP(0xdf, 0x01), /* 0x03: MBOX_DUMP_RAM */
5126 ISPOPMAP(0x07, 0x07), /* 0x04: MBOX_WRITE_RAM_WORD */
5127 ISPOPMAP(0x03, 0x07), /* 0x05: MBOX_READ_RAM_WORD */
5128 ISPOPMAP(0xff, 0xff), /* 0x06: MBOX_MAILBOX_REG_TEST */
5129 ISPOPMAP(0x03, 0x05), /* 0x07: MBOX_VERIFY_CHECKSUM */

--- 256 unchanged lines hidden (view full) ---

5386 "Lun RESET"
5387};
5388#endif
5389
5390static void
5391isp_mboxcmd_qnw(struct ispsoftc *isp, mbreg_t *mbp, int nodelay)
5392{
5393 unsigned int ibits, obits, box, opcode;
5315 const u_int16_t *mcp;
5394 const u_int32_t *mcp;
5316
5317 if (IS_FC(isp)) {
5318 mcp = mbpfc;
5319 } else {
5320 mcp = mbpscsi;
5321 }
5322 opcode = mbp->param[0];
5395
5396 if (IS_FC(isp)) {
5397 mcp = mbpfc;
5398 } else {
5399 mcp = mbpscsi;
5400 }
5401 opcode = mbp->param[0];
5323 ibits = HIBYT(mcp[opcode]) & NMBOX_BMASK(isp);
5324 obits = LOBYT(mcp[opcode]) & NMBOX_BMASK(isp);
5325 for (box = 0; box < MAX_MAILBOX; box++) {
5402 ibits = HIWRD(mcp[opcode]) & NMBOX_BMASK(isp);
5403 obits = LOWRD(mcp[opcode]) & NMBOX_BMASK(isp);
5404 ibits |= mbp->ibits;
5405 obits |= mbp->obits;
5406 for (box = 0; box < MAX_MAILBOX(isp); box++) {
5326 if (ibits & (1 << box)) {
5327 ISP_WRITE(isp, MBOX_OFF(box), mbp->param[box]);
5328 }
5329 if (nodelay == 0) {
5330 isp->isp_mboxtmp[box] = mbp->param[box] = 0;
5331 }
5332 }
5333 if (nodelay == 0) {

--- 12 unchanged lines hidden (view full) ---

5346 }
5347}
5348
5349static void
5350isp_mboxcmd(struct ispsoftc *isp, mbreg_t *mbp, int logmask)
5351{
5352 char *cname, *xname, tname[16], mname[16];
5353 unsigned int lim, ibits, obits, box, opcode;
5407 if (ibits & (1 << box)) {
5408 ISP_WRITE(isp, MBOX_OFF(box), mbp->param[box]);
5409 }
5410 if (nodelay == 0) {
5411 isp->isp_mboxtmp[box] = mbp->param[box] = 0;
5412 }
5413 }
5414 if (nodelay == 0) {

--- 12 unchanged lines hidden (view full) ---

5427 }
5428}
5429
5430static void
5431isp_mboxcmd(struct ispsoftc *isp, mbreg_t *mbp, int logmask)
5432{
5433 char *cname, *xname, tname[16], mname[16];
5434 unsigned int lim, ibits, obits, box, opcode;
5354 const u_int16_t *mcp;
5435 const u_int32_t *mcp;
5355
5356 if (IS_FC(isp)) {
5357 mcp = mbpfc;
5358 lim = (sizeof (mbpfc) / sizeof (mbpfc[0]));
5359 } else {
5360 mcp = mbpscsi;
5361 lim = (sizeof (mbpscsi) / sizeof (mbpscsi[0]));
5362 }
5363
5364 if ((opcode = mbp->param[0]) >= lim) {
5365 mbp->param[0] = MBOX_INVALID_COMMAND;
5366 isp_prt(isp, ISP_LOGERR, "Unknown Command 0x%x", opcode);
5367 return;
5368 }
5369
5436
5437 if (IS_FC(isp)) {
5438 mcp = mbpfc;
5439 lim = (sizeof (mbpfc) / sizeof (mbpfc[0]));
5440 } else {
5441 mcp = mbpscsi;
5442 lim = (sizeof (mbpscsi) / sizeof (mbpscsi[0]));
5443 }
5444
5445 if ((opcode = mbp->param[0]) >= lim) {
5446 mbp->param[0] = MBOX_INVALID_COMMAND;
5447 isp_prt(isp, ISP_LOGERR, "Unknown Command 0x%x", opcode);
5448 return;
5449 }
5450
5370 ibits = HIBYT(mcp[opcode]) & NMBOX_BMASK(isp);
5371 obits = LOBYT(mcp[opcode]) & NMBOX_BMASK(isp);
5451 ibits = HIWRD(mcp[opcode]) & NMBOX_BMASK(isp);
5452 obits = LOWRD(mcp[opcode]) & NMBOX_BMASK(isp);
5372
5453
5454 ibits |= mbp->ibits;
5455 obits |= mbp->obits;
5456
5373 if (ibits == 0 && obits == 0) {
5374 mbp->param[0] = MBOX_COMMAND_PARAM_ERROR;
5375 isp_prt(isp, ISP_LOGERR, "no parameters for 0x%x", opcode);
5376 return;
5377 }
5378
5379 /*
5380 * Get exclusive usage of mailbox registers.
5381 */
5382 MBOX_ACQUIRE(isp);
5383
5457 if (ibits == 0 && obits == 0) {
5458 mbp->param[0] = MBOX_COMMAND_PARAM_ERROR;
5459 isp_prt(isp, ISP_LOGERR, "no parameters for 0x%x", opcode);
5460 return;
5461 }
5462
5463 /*
5464 * Get exclusive usage of mailbox registers.
5465 */
5466 MBOX_ACQUIRE(isp);
5467
5384 for (box = 0; box < MAX_MAILBOX; box++) {
5468 for (box = 0; box < MAX_MAILBOX(isp); box++) {
5385 if (ibits & (1 << box)) {
5386 ISP_WRITE(isp, MBOX_OFF(box), mbp->param[box]);
5387 }
5388 isp->isp_mboxtmp[box] = mbp->param[box] = 0;
5389 }
5390
5391 isp->isp_lastmbxcmd = opcode;
5392

--- 20 unchanged lines hidden (view full) ---

5413 isp->isp_mboxbsy = 0;
5414 MBOX_RELEASE(isp);
5415 return;
5416 }
5417
5418 /*
5419 * Copy back output registers.
5420 */
5469 if (ibits & (1 << box)) {
5470 ISP_WRITE(isp, MBOX_OFF(box), mbp->param[box]);
5471 }
5472 isp->isp_mboxtmp[box] = mbp->param[box] = 0;
5473 }
5474
5475 isp->isp_lastmbxcmd = opcode;
5476

--- 20 unchanged lines hidden (view full) ---

5497 isp->isp_mboxbsy = 0;
5498 MBOX_RELEASE(isp);
5499 return;
5500 }
5501
5502 /*
5503 * Copy back output registers.
5504 */
5421 for (box = 0; box < MAX_MAILBOX; box++) {
5505 for (box = 0; box < MAX_MAILBOX(isp); box++) {
5422 if (obits & (1 << box)) {
5423 mbp->param[box] = isp->isp_mboxtmp[box];
5424 }
5425 }
5426
5427 MBOX_RELEASE(isp);
5428
5429 if (logmask == 0 || opcode == MBOX_EXEC_FIRMWARE) {

--- 63 unchanged lines hidden (view full) ---

5493
5494static void
5495isp_fw_state(struct ispsoftc *isp)
5496{
5497 if (IS_FC(isp)) {
5498 mbreg_t mbs;
5499 fcparam *fcp = isp->isp_param;
5500
5506 if (obits & (1 << box)) {
5507 mbp->param[box] = isp->isp_mboxtmp[box];
5508 }
5509 }
5510
5511 MBOX_RELEASE(isp);
5512
5513 if (logmask == 0 || opcode == MBOX_EXEC_FIRMWARE) {

--- 63 unchanged lines hidden (view full) ---

5577
5578static void
5579isp_fw_state(struct ispsoftc *isp)
5580{
5581 if (IS_FC(isp)) {
5582 mbreg_t mbs;
5583 fcparam *fcp = isp->isp_param;
5584
5585 MEMZERO(&mbs, sizeof (mbs));
5501 mbs.param[0] = MBOX_GET_FW_STATE;
5502 isp_mboxcmd(isp, &mbs, MBLOGALL);
5503 if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
5504 fcp->isp_fwstate = mbs.param[1];
5505 }
5506 }
5507}
5508

--- 21 unchanged lines hidden (view full) ---

5530 if (IS_FC(isp)) {
5531 /*
5532 * There are no 'per-bus' settings for Fibre Channel.
5533 */
5534 return;
5535 }
5536 sdp = isp->isp_param;
5537 sdp += bus;
5586 mbs.param[0] = MBOX_GET_FW_STATE;
5587 isp_mboxcmd(isp, &mbs, MBLOGALL);
5588 if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
5589 fcp->isp_fwstate = mbs.param[1];
5590 }
5591 }
5592}
5593

--- 21 unchanged lines hidden (view full) ---

5615 if (IS_FC(isp)) {
5616 /*
5617 * There are no 'per-bus' settings for Fibre Channel.
5618 */
5619 return;
5620 }
5621 sdp = isp->isp_param;
5622 sdp += bus;
5623 MEMZERO(&mbs, sizeof (mbs));
5538
5539 for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
5540 u_int16_t flags, period, offset;
5541 int get;
5542
5543 if (sdp->isp_devparam[tgt].dev_enable == 0) {
5544 sdp->isp_devparam[tgt].dev_update = 0;
5545 sdp->isp_devparam[tgt].dev_refresh = 0;

--- 99 unchanged lines hidden (view full) ---

5645
5646static void
5647isp_setdfltparm(struct ispsoftc *isp, int channel)
5648{
5649 int tgt;
5650 mbreg_t mbs;
5651 sdparam *sdp;
5652
5624
5625 for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
5626 u_int16_t flags, period, offset;
5627 int get;
5628
5629 if (sdp->isp_devparam[tgt].dev_enable == 0) {
5630 sdp->isp_devparam[tgt].dev_update = 0;
5631 sdp->isp_devparam[tgt].dev_refresh = 0;

--- 99 unchanged lines hidden (view full) ---

5731
5732static void
5733isp_setdfltparm(struct ispsoftc *isp, int channel)
5734{
5735 int tgt;
5736 mbreg_t mbs;
5737 sdparam *sdp;
5738
5739 MEMZERO(&mbs, sizeof (mbs));
5653 if (IS_FC(isp)) {
5654 fcparam *fcp = (fcparam *) isp->isp_param;
5655 int nvfail;
5656
5657 fcp += channel;
5658 if (fcp->isp_gotdparms) {
5659 return;
5660 }

--- 801 unchanged lines hidden (view full) ---

6462
6463static void
6464isp2200_fw_dump(struct ispsoftc *isp)
6465{
6466 int i, j;
6467 mbreg_t mbs;
6468 u_int16_t *ptr;
6469
5740 if (IS_FC(isp)) {
5741 fcparam *fcp = (fcparam *) isp->isp_param;
5742 int nvfail;
5743
5744 fcp += channel;
5745 if (fcp->isp_gotdparms) {
5746 return;
5747 }

--- 801 unchanged lines hidden (view full) ---

6549
6550static void
6551isp2200_fw_dump(struct ispsoftc *isp)
6552{
6553 int i, j;
6554 mbreg_t mbs;
6555 u_int16_t *ptr;
6556
6557 MEMZERO(&mbs, sizeof (mbs));
6470 ptr = FCPARAM(isp)->isp_dump_data;
6471 if (ptr == NULL) {
6472 isp_prt(isp, ISP_LOGERR,
6473 "No place to dump RISC registers and SRAM");
6474 return;
6475 }
6476 if (*ptr++) {
6477 isp_prt(isp, ISP_LOGERR,

--- 128 unchanged lines hidden (view full) ---

6606
6607static void
6608isp2300_fw_dump(struct ispsoftc *isp)
6609{
6610 int i, j;
6611 mbreg_t mbs;
6612 u_int16_t *ptr;
6613
6558 ptr = FCPARAM(isp)->isp_dump_data;
6559 if (ptr == NULL) {
6560 isp_prt(isp, ISP_LOGERR,
6561 "No place to dump RISC registers and SRAM");
6562 return;
6563 }
6564 if (*ptr++) {
6565 isp_prt(isp, ISP_LOGERR,

--- 128 unchanged lines hidden (view full) ---

6694
6695static void
6696isp2300_fw_dump(struct ispsoftc *isp)
6697{
6698 int i, j;
6699 mbreg_t mbs;
6700 u_int16_t *ptr;
6701
6702 MEMZERO(&mbs, sizeof (mbs));
6614 ptr = FCPARAM(isp)->isp_dump_data;
6615 if (ptr == NULL) {
6616 isp_prt(isp, ISP_LOGERR,
6617 "No place to dump RISC registers and SRAM");
6618 return;
6619 }
6620 if (*ptr++) {
6621 isp_prt(isp, ISP_LOGERR,

--- 157 unchanged lines hidden ---
6703 ptr = FCPARAM(isp)->isp_dump_data;
6704 if (ptr == NULL) {
6705 isp_prt(isp, ISP_LOGERR,
6706 "No place to dump RISC registers and SRAM");
6707 return;
6708 }
6709 if (*ptr++) {
6710 isp_prt(isp, ISP_LOGERR,

--- 157 unchanged lines hidden ---