summaryrefslogtreecommitdiff
path: root/sys/dev/ic/isp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ic/isp.c')
-rw-r--r--sys/dev/ic/isp.c94
1 files changed, 65 insertions, 29 deletions
diff --git a/sys/dev/ic/isp.c b/sys/dev/ic/isp.c
index f523bc3a9c8..e54e65fb1a0 100644
--- a/sys/dev/ic/isp.c
+++ b/sys/dev/ic/isp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isp.c,v 1.42 2008/05/28 18:40:21 kettenis Exp $ */
+/* $OpenBSD: isp.c,v 1.43 2008/06/11 22:53:46 krw Exp $ */
/*
* Machine and OS Independent (well, as best as possible)
* code for the QLogic ISP SCSI adapters.
@@ -203,6 +203,7 @@ isp_reset(struct ispsoftc *isp)
* Just in case it was paused...
*/
ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE);
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_ABOUT_FIRMWARE;
isp_mboxcmd(isp, &mbs, MBLOGNONE);
if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
@@ -593,6 +594,7 @@ again:
/*
* Do some sanity checking.
*/
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_NO_OP;
isp_mboxcmd(isp, &mbs, MBLOGALL);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
@@ -600,6 +602,7 @@ again:
}
if (IS_SCSI(isp)) {
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_MAILBOX_REG_TEST;
mbs.param[1] = 0xdead;
mbs.param[2] = 0xbeef;
@@ -645,6 +648,7 @@ again:
isp->isp_mbxworkp = (void *) &isp->isp_mdvec->dv_ispfw[1];
isp->isp_mbxwrk0 = isp->isp_mdvec->dv_ispfw[3] - 1;
isp->isp_mbxwrk1 = code_org + 1;
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_WRITE_RAM_WORD;
mbs.param[1] = code_org;
mbs.param[2] = isp->isp_mdvec->dv_ispfw[0];
@@ -659,6 +663,7 @@ again:
/*
* Verify that it downloaded correctly.
*/
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_VERIFY_CHECKSUM;
mbs.param[1] = code_org;
isp_mboxcmd(isp, &mbs, MBLOGNONE);
@@ -680,6 +685,7 @@ again:
*/
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_EXEC_FIRMWARE;
mbs.param[1] = code_org;
isp_mboxcmd(isp, &mbs, MBLOGNONE);
@@ -693,6 +699,7 @@ again:
* Set CLOCK RATE, but only if asked to.
*/
if (isp->isp_clock) {
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_SET_CLOCK_RATE;
mbs.param[1] = isp->isp_clock;
isp_mboxcmd(isp, &mbs, MBLOGALL);
@@ -700,6 +707,7 @@ again:
}
}
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_ABOUT_FIRMWARE;
isp_mboxcmd(isp, &mbs, MBLOGALL);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
@@ -764,6 +772,7 @@ again:
isp->isp_romfw_rev[2]);
}
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_GET_FIRMWARE_STATUS;
isp_mboxcmd(isp, &mbs, MBLOGALL);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
@@ -874,6 +883,7 @@ isp_scsi_init(struct ispsoftc *isp)
* Set Retry Delay and Count.
* You set both channels at the same time.
*/
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_SET_RETRY_COUNT;
mbs.param[1] = sdp_chan0->isp_retry_count;
mbs.param[2] = sdp_chan0->isp_retry_delay;
@@ -888,6 +898,7 @@ isp_scsi_init(struct ispsoftc *isp)
/*
* Set ASYNC DATA SETUP time. This is very important.
*/
+ MEMZERO(&mbs, sizeof (mbs));
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;
@@ -899,6 +910,7 @@ isp_scsi_init(struct ispsoftc *isp)
/*
* Set ACTIVE Negation State.
*/
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_SET_ACT_NEG_STATE;
mbs.param[1] =
(sdp_chan0->isp_req_ack_active_neg << 4) |
@@ -923,6 +935,7 @@ isp_scsi_init(struct ispsoftc *isp)
/*
* Set the Tag Aging limit
*/
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_SET_TAG_AGE_LIMIT;
mbs.param[1] = sdp_chan0->isp_tag_aging;
mbs.param[2] = sdp_chan1->isp_tag_aging;
@@ -936,6 +949,7 @@ isp_scsi_init(struct ispsoftc *isp)
/*
* Set selection timeout.
*/
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_SET_SELECT_TIMEOUT;
mbs.param[1] = sdp_chan0->isp_selection_timeout;
mbs.param[2] = sdp_chan1->isp_selection_timeout;
@@ -954,6 +968,7 @@ isp_scsi_init(struct ispsoftc *isp)
*/
if (IS_ULTRA2(isp) || IS_1240(isp)) {
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_INIT_RES_QUEUE_A64;
mbs.param[1] = RESULT_QUEUE_LEN(isp);
mbs.param[2] = DMA_WD1(isp->isp_result_dma);
@@ -967,6 +982,7 @@ isp_scsi_init(struct ispsoftc *isp)
}
isp->isp_residx = mbs.param[5];
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_INIT_REQ_QUEUE_A64;
mbs.param[1] = RQUEST_QUEUE_LEN(isp);
mbs.param[2] = DMA_WD1(isp->isp_rquest_dma);
@@ -980,6 +996,7 @@ isp_scsi_init(struct ispsoftc *isp)
}
isp->isp_reqidx = isp->isp_reqodx = mbs.param[4];
} else {
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_INIT_RES_QUEUE;
mbs.param[1] = RESULT_QUEUE_LEN(isp);
mbs.param[2] = DMA_WD1(isp->isp_result_dma);
@@ -991,6 +1008,7 @@ isp_scsi_init(struct ispsoftc *isp)
}
isp->isp_residx = mbs.param[5];
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_INIT_REQ_QUEUE;
mbs.param[1] = RQUEST_QUEUE_LEN(isp);
mbs.param[2] = DMA_WD1(isp->isp_rquest_dma);
@@ -1012,6 +1030,7 @@ isp_scsi_init(struct ispsoftc *isp)
* to assume not for them.
*/
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_SET_FW_FEATURES;
mbs.param[1] = 0;
if (IS_ULTRA2(isp))
@@ -1053,6 +1072,7 @@ isp_scsi_channel_init(struct ispsoftc *isp, int channel)
/*
* Set (possibly new) Initiator ID.
*/
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_SET_INIT_SCSI_ID;
mbs.param[1] = (channel << 7) | sdp->isp_initiator_id;
isp_mboxcmd(isp, &mbs, MBLOGALL);
@@ -1096,6 +1116,7 @@ isp_scsi_channel_init(struct ispsoftc *isp, int channel)
*/
sdp->isp_devparam[tgt].goal_flags = sdf = DPARM_DEFAULT;
#endif
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_SET_TARGET_PARAMS;
mbs.param[1] = (channel << 15) | (tgt << 8);
mbs.param[2] = sdf;
@@ -1113,6 +1134,7 @@ isp_scsi_channel_init(struct ispsoftc *isp, int channel)
isp_mboxcmd(isp, &mbs, MBLOGNONE);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
sdf = DPARM_SAFE_DFLT;
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_SET_TARGET_PARAMS;
mbs.param[1] = (tgt << 8) | (channel << 15);
mbs.param[2] = sdf;
@@ -1136,6 +1158,7 @@ isp_scsi_channel_init(struct ispsoftc *isp, int channel)
*/
sdp->isp_devparam[tgt].actv_flags = sdf & ~DPARM_TQING;
for (lun = 0; lun < (int) isp->isp_maxluns; lun++) {
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_SET_DEV_QUEUE_PARAMS;
mbs.param[1] = (channel << 15) | (tgt << 8) | lun;
mbs.param[2] = sdp->isp_max_queue_depth;
@@ -1340,6 +1363,7 @@ isp_fibre_init(struct ispsoftc *isp)
* Turn on generate AE 8013 on all LIP Resets (2)
* Disable LIP F7 switching (8)
*/
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_SET_FIRMWARE_OPTIONS;
mbs.param[1] = 0xb;
mbs.param[2] = 0;
@@ -1391,14 +1415,15 @@ isp_fibre_init(struct ispsoftc *isp)
/*
* Init the firmware
*/
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_INIT_FIRMWARE;
- mbs.param[1] = 0;
mbs.param[2] = DMA_WD1(fcp->isp_scdma);
mbs.param[3] = DMA_WD0(fcp->isp_scdma);
- mbs.param[4] = 0;
- mbs.param[5] = 0;
mbs.param[6] = DMA_WD3(fcp->isp_scdma);
mbs.param[7] = DMA_WD2(fcp->isp_scdma);
+ isp_prt(isp, ISP_LOGDEBUG0, "INIT F/W from %p (%08x%08x)",
+ fcp->isp_scratch, (uint32_t) ((uint64_t)fcp->isp_scdma >> 32),
+ (uint32_t) fcp->isp_scdma);
isp_mboxcmd(isp, &mbs, MBLOGALL);
FC_SCRATCH_RELEASE(isp);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
@@ -1427,19 +1452,10 @@ isp_getmap(struct ispsoftc *isp, fcpos_map_t *map)
fcparam *fcp = (fcparam *) isp->isp_param;
mbreg_t mbs;
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_GET_FC_AL_POSITION_MAP;
- mbs.param[1] = 0;
mbs.param[2] = DMA_WD1(fcp->isp_scdma);
mbs.param[3] = DMA_WD0(fcp->isp_scdma);
- /*
- * 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;
- *
- */
- mbs.param[6] = 0;
- mbs.param[7] = 0;
FC_SCRATCH_ACQUIRE(isp);
isp_mboxcmd(isp, &mbs, MBLOGALL & ~MBOX_COMMAND_PARAM_ERROR);
if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
@@ -1468,17 +1484,11 @@ isp_getpdb(struct ispsoftc *isp, int id, isp_pdb_t *pdbp)
fcparam *fcp = (fcparam *) isp->isp_param;
mbreg_t mbs;
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_GET_PORT_DB;
mbs.param[1] = id << 8;
mbs.param[2] = DMA_WD1(fcp->isp_scdma);
mbs.param[3] = DMA_WD0(fcp->isp_scdma);
- /*
- * 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;
- *
- */
mbs.param[6] = DMA_WD3(fcp->isp_scdma);
mbs.param[7] = DMA_WD2(fcp->isp_scdma);
FC_SCRATCH_ACQUIRE(isp);
@@ -1498,6 +1508,7 @@ isp_get_portname(struct ispsoftc *isp, int loopid, int nodename)
u_int64_t wwn = 0;
mbreg_t mbs;
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_GET_PORT_NAME;
mbs.param[1] = loopid << 8;
if (nodename)
@@ -1617,6 +1628,7 @@ isp_fclink_test(struct ispsoftc *isp, int usdelay)
/*
* Get our Loop ID (if possible). We really need to have it.
*/
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_GET_LOOP_ID;
isp_mboxcmd(isp, &mbs, MBLOGALL);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
@@ -1710,6 +1722,7 @@ not_on_fabric:
fcp->isp_gbspeed = 1;
if (IS_23XX(isp)) {
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_GET_SET_DATA_RATE;
mbs.param[1] = MBGSD_GET_RATE;
/* mbs.param[2] undefined if we're just getting rate */
@@ -1936,10 +1949,9 @@ isp_pdb_sync(struct ispsoftc *isp)
if (lp->loggedin) {
if (lp->force_logout ||
isp_getpdb(isp, lp->loopid, &pdb) == 0) {
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_FABRIC_LOGOUT;
mbs.param[1] = lp->loopid << 8;
- mbs.param[2] = 0;
- mbs.param[3] = 0;
isp_mboxcmd(isp, &mbs, MBLOGNONE);
isp_prt(isp, ISP_LOGINFO, plogout,
(int) (lp - fcp->portdb), lp->loopid,
@@ -1958,6 +1970,7 @@ isp_pdb_sync(struct ispsoftc *isp)
loopid = lp - fcp->portdb;
lp->loopid = FL_PORT_ID;
do {
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_FABRIC_LOGIN;
mbs.param[1] = loopid << 8;
mbs.param[2] = portid >> 16;
@@ -2074,6 +2087,7 @@ dump_em:
lp->valid = 0;
isp_prt(isp, ISP_LOGINFO,
ldumped, loopid, lp->loopid, lp->portid);
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_FABRIC_LOGOUT;
mbs.param[1] = lp->loopid << 8;
mbs.param[2] = 0;
@@ -2369,6 +2383,7 @@ isp_scan_loop(struct ispsoftc *isp)
static int
isp_fabric_mbox_cmd(struct ispsoftc *isp, mbreg_t *mbp)
{
+ /* the caller sets up the mailbox */
isp_mboxcmd(isp, mbp, MBLOGNONE);
if (mbp->param[0] != MBOX_COMMAND_COMPLETE) {
if (FCPARAM(isp)->isp_loopstate == LOOP_SCANNING_FABRIC) {
@@ -2458,6 +2473,7 @@ isp_scan_fabric(struct ispsoftc *isp, int ftype)
rq->snscb_data[5] = (portid >> 16) & 0xff;
isp_put_sns_request(isp, rq, (sns_screq_t *) fcp->isp_scratch);
MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GA_NXT_REQ_SIZE);
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_SEND_SNS;
mbs.param[1] = SNS_GA_NXT_REQ_SIZE >> 1;
mbs.param[2] = DMA_WD1(fcp->isp_scdma);
@@ -2608,6 +2624,7 @@ isp_scan_fabric(struct ispsoftc *isp, int ftype)
rq->snscb_fc4_type = ftype;
isp_put_gid_ft_request(isp, rq, (sns_gid_ft_req_t *) fcp->isp_scratch);
MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GID_FT_REQ_SIZE);
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_SEND_SNS;
mbs.param[1] = SNS_GID_FT_REQ_SIZE >> 1;
mbs.param[2] = DMA_WD1(fcp->isp_scdma);
@@ -2685,6 +2702,7 @@ isp_scan_fabric(struct ispsoftc *isp, int ftype)
isp_put_gxn_id_request(isp, gq,
(sns_gxn_id_req_t *) fcp->isp_scratch);
MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GXN_ID_REQ_SIZE);
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_SEND_SNS;
mbs.param[1] = SNS_GXN_ID_REQ_SIZE >> 1;
mbs.param[2] = DMA_WD1(fcp->isp_scdma);
@@ -2740,6 +2758,7 @@ isp_scan_fabric(struct ispsoftc *isp, int ftype)
isp_put_gxn_id_request(isp, gq,
(sns_gxn_id_req_t *) fcp->isp_scratch);
MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GXN_ID_REQ_SIZE);
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_SEND_SNS;
mbs.param[1] = SNS_GXN_ID_REQ_SIZE >> 1;
mbs.param[2] = DMA_WD1(fcp->isp_scdma);
@@ -2803,6 +2822,7 @@ isp_scan_fabric(struct ispsoftc *isp, int ftype)
isp_put_gxn_id_request(isp, gq,
(sns_gxn_id_req_t *) fcp->isp_scratch);
MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GXN_ID_REQ_SIZE);
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_SEND_SNS;
mbs.param[1] = SNS_GXN_ID_REQ_SIZE >> 1;
mbs.param[2] = DMA_WD1(fcp->isp_scdma);
@@ -2904,6 +2924,7 @@ isp_register_fc4_type(struct ispsoftc *isp)
#endif
FC_SCRATCH_ACQUIRE(isp);
isp_put_sns_request(isp, reqp, (sns_screq_t *) fcp->isp_scratch);
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_SEND_SNS;
mbs.param[1] = SNS_RFT_ID_REQ_SIZE >> 1;
mbs.param[2] = DMA_WD1(fcp->isp_scdma);
@@ -3315,8 +3336,8 @@ isp_control(struct ispsoftc *isp, ispctl_t ctl, void *arg)
/*
* Issue a bus reset.
*/
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_BUS_RESET;
- mbs.param[2] = 0;
if (IS_SCSI(isp)) {
mbs.param[1] =
((sdparam *) isp->isp_param)->isp_bus_reset_delay;
@@ -3341,6 +3362,7 @@ isp_control(struct ispsoftc *isp, ispctl_t ctl, void *arg)
case ISPCTL_RESET_DEV:
tgt = (*((int *) arg)) & 0xffff;
bus = (*((int *) arg)) >> 16;
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_ABORT_TARGET;
mbs.param[1] = (tgt << 8) | (bus << 15);
mbs.param[2] = 3; /* 'delay', in seconds */
@@ -3363,6 +3385,7 @@ isp_control(struct ispsoftc *isp, ispctl_t ctl, void *arg)
break;
}
bus = XS_CHANNEL(xs);
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_ABORT;
if (IS_FC(isp)) {
if (FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) {
@@ -3377,7 +3400,6 @@ isp_control(struct ispsoftc *isp, ispctl_t ctl, void *arg)
mbs.param[1] =
(bus << 15) | (XS_TGT(xs) << 8) | XS_LUN(xs);
}
- mbs.param[3] = 0;
mbs.param[2] = handle;
isp_mboxcmd(isp, &mbs, MBLOGALL & ~MBOX_COMMAND_ERROR);
if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
@@ -3427,6 +3449,7 @@ isp_control(struct ispsoftc *isp, ispctl_t ctl, void *arg)
case ISPCTL_SEND_LIP:
if (IS_FC(isp)) {
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_INIT_LIP;
isp_mboxcmd(isp, &mbs, MBLOGALL);
if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
@@ -3457,6 +3480,7 @@ isp_control(struct ispsoftc *isp, ispctl_t ctl, void *arg)
*/
if (IS_SCSI(isp)) {
int param = *(int *)arg;
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_ENABLE_TARGET_MODE;
mbs.param[1] = param & 0xffff;
mbs.param[2] = param >> 16;
@@ -4659,6 +4683,7 @@ isp_parse_status(struct ispsoftc *isp, ispstatusreq_t *sp, XS_T *xs)
if (FCPARAM(isp)->isp_topo == TOPO_NL_PORT ||
FCPARAM(isp)->isp_topo == TOPO_FL_PORT) {
mbreg_t mbs;
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_INIT_LIP;
isp_mboxcmd_qnw(isp, &mbs, 1);
}
@@ -4776,6 +4801,7 @@ isp_mbox_continue(struct ispsoftc *isp)
break;
}
isp->isp_mbxworkp = ptr;
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = isp->isp_lastmbxcmd;
isp->isp_mbxwrk0 -= 1;
isp_mboxcmd_qnw(isp, &mbs, 0);
@@ -5273,6 +5299,8 @@ isp_mboxcmd_qnw(struct ispsoftc *isp, mbreg_t *mbp, int nodelay)
obits = LOBYT(mcp[opcode]) & NMBOX_BMASK(isp);
for (box = 0; box < MAX_MAILBOX; box++) {
if (ibits & (1 << box)) {
+ isp_prt(isp, ISP_LOGDEBUG1, "IN mbox %d = 0x%x", box,
+ mbp->param[box]);
ISP_WRITE(isp, MBOX_OFF(box), mbp->param[box]);
}
if (nodelay == 0) {
@@ -5370,6 +5398,8 @@ isp_mboxcmd(struct ispsoftc *isp, mbreg_t *mbp, int logmask)
for (box = 0; box < MAX_MAILBOX; box++) {
if (obits & (1 << box)) {
mbp->param[box] = isp->isp_mboxtmp[box];
+ isp_prt(isp, ISP_LOGDEBUG1, "OUT mbox %d = 0x%x", box,
+ mbp->param[box]);
}
}
@@ -5447,6 +5477,7 @@ isp_fw_state(struct ispsoftc *isp)
mbreg_t mbs;
fcparam *fcp = isp->isp_param;
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_GET_FW_STATE;
isp_mboxcmd(isp, &mbs, MBLOGALL);
if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
@@ -5503,6 +5534,8 @@ isp_update_bus(struct ispsoftc *isp, int bus)
* current device state, get the current parameters.
*/
+ MEMZERO(&mbs, sizeof (mbs));
+
/*
* Refresh overrides set
*/
@@ -5529,9 +5562,7 @@ isp_update_bus(struct ispsoftc *isp, int bus)
mbs.param[2] |= DPARM_PARITY;
}
- if ((mbs.param[2] & DPARM_SYNC) == 0) {
- mbs.param[3] = 0;
- } else {
+ if (mbs.param[2] & DPARM_SYNC) {
mbs.param[3] =
(sdp->isp_devparam[tgt].goal_offset << 8) |
(sdp->isp_devparam[tgt].goal_period);
@@ -5596,7 +5627,6 @@ static void
isp_setdfltparm(struct ispsoftc *isp, int channel)
{
int tgt;
- mbreg_t mbs;
sdparam *sdp;
if (IS_FC(isp)) {
@@ -5736,6 +5766,9 @@ isp_setdfltparm(struct ispsoftc *isp, int channel)
* Now try and see whether we have specific values for them.
*/
if ((isp->isp_confopts & ISP_CFG_NONVRAM) == 0) {
+ mbreg_t mbs;
+
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_GET_ACT_NEG_STATE;
isp_mboxcmd(isp, &mbs, MBLOGNONE);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
@@ -6530,6 +6563,7 @@ isp2200_fw_dump(struct ispsoftc *isp)
}
}
ENABLE_INTS(isp);
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_READ_RAM_WORD;
mbs.param[1] = 0x1000;
isp->isp_mbxworkp = (void *) ptr;
@@ -6672,6 +6706,7 @@ isp2300_fw_dump(struct ispsoftc *isp)
return;
}
ENABLE_INTS(isp);
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_READ_RAM_WORD;
mbs.param[1] = 0x800;
isp->isp_mbxworkp = (void *) ptr;
@@ -6693,6 +6728,7 @@ isp2300_fw_dump(struct ispsoftc *isp)
*/
ISP_WRITE(isp, PCI_MBOX_REGS2300_OFF + (8 << 1), 0x1);
+ MEMZERO(&mbs, sizeof (mbs));
mbs.param[0] = MBOX_READ_RAM_WORD_EXTENDED;
mbs.param[1] = 0;
isp->isp_mbxworkp = (void *) ptr;